next | previous | forward | backward | up | top | index | toc | Macaulay2 web site
Divisor :: applyToCoefficients

applyToCoefficients -- Applies a function to the coefficients of a divisor

Synopsis

Description

applyToCoefficients applies the function h to the coefficients of the divisor of D. Specifying the CoeffType=>ZZ, CoeffType=>QQ, CoeffType=>RR, will force the output divisor to be of a certain form (WDiv, QDiv, RDiv respectively), otherwise the class of the output D is the same as the class of the input D1 (WDiv, QDiv, RDiv, or BasicDiv). If Unsafe is set to false (the default is true), then the function will check to make sure the output is really a valid divisor.

i1 : R = QQ[x, y, z];
i2 : D = divisor(x*y^2/z)

o2 = 2*Div(y) + -1*Div(z) + 1*Div(x) of R

o2 : WDiv
i3 : applyToCoefficients(D, z->5*z)

o3 = -5*Div(z) + 10*Div(y) + 5*Div(x) of R

o3 : WDiv

See also

Ways to use applyToCoefficients :