Macaulay2 » Documentation
Packages » Macaulay2Doc » rings » substitution and maps between rings » working with multiple rings » promote » setupPromote
next | previous | forward | backward | up | index | toc

setupPromote -- set up promote from one ring to another

Description

This defines promotion from one ring R to another ring S as the application of a ring map or function f. After calling setupPromote, any operation that is given an element of R but expects an element of S will automatically promote it by applying f.

Note that R and S must be specified when f is a function, but may be omitted when it is a ring map.

i1 : R=QQ[x_1,x_2]

o1 = R

o1 : PolynomialRing
i2 : R'=QQ[e_1,e_2,Degrees=>{1,2}]

o2 = R'

o2 : PolynomialRing
i3 : setupPromote map(R,R',{x_1+x_2,x_1*x_2})
i4 : promote(e_1^2,R)

      2            2
o4 = x  + 2x x  + x
      1     1 2    2

o4 : R
i5 : e_1*x_1

      2
o5 = x  + x x
      1    1 2

o5 : R
i6 : e_2==x_1*x_2

o6 = true

If f is omitted, then the map created by map(Ring,Ring) that maps variables in R to variables in S with the same name is used.

i7 : R = QQ[x]

o7 = R

o7 : PolynomialRing
i8 : S = QQ[x,y]

o8 = S

o8 : PolynomialRing
i9 : setupPromote(R, S)
i10 : promote(R_0, S)

o10 = x

o10 : S

The optional argument d is a function that translates degrees from R to S. It is used to set up promote(List, R, S), which translates degree lists when promoting free modules. When f is a function, there is no DegreeMap option available, so d must be specified explicitly if the degree map is not the default (which pads or truncates degrees). Consider the following example.

i11 : R = QQ[x]

o11 = R

o11 : PolynomialRing
i12 : S = QQ[a, b, Degrees => {{1,0},{0,1}}]

o12 = S

o12 : PolynomialRing
i13 : setupPromote(r -> sub(r, x => b), R, S)
i14 : promote(R^{1,2}, S) -- wrong degrees!

       2
o14 = S

o14 : S-module, free, degrees {{-1, 0}, {-2, 0}}
i15 : setupPromote(r -> sub(r, x => b), R, S, d -> {0, d#0})
i16 : promote(R^{1,2}, S)

       2
o16 = S

o16 : S-module, free, degrees {{0, -1}, {0, -2}}

See also

Ways to use setupPromote:

  • setupPromote(Function,Ring,Ring)
  • setupPromote(Function,Ring,Ring,Function)
  • setupPromote(Ring,Ring)
  • setupPromote(RingMap)
  • setupPromote(RingMap,Ring,Ring)
  • setupPromote(RingMap,Ring,Ring,Function)

For the programmer

The object setupPromote is a method function.


The source of this document is in /build/reproducible-path/macaulay2-1.26.05+ds/M2/Macaulay2/packages/Macaulay2Doc/functions/setupPromote-doc.m2:70:0.