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

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



applyToCoefficients applies the function h to the coefficients of the divisor of D1. Specifying the CoefficientType=>ZZ, CoefficientType=>QQ, CoefficientType=>RR, will force the returned divisor to be of a certain form (WeilDivisor, QWeilDivisor, RWeilDivisor respectively), otherwise the class of the output D is the same as the class of the input D1 (WeilDivisor, QWeilDivisor, RWeilDivisor, BasicDivisor). If Safe is set to true (the default is false), then the function will check to make sure the output is a valid divisor.

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

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

o2 : WeilDivisor on R
i3 : applyToCoefficients(D, u->5*u)

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

o3 : WeilDivisor on R

See also

Ways to use applyToCoefficients :

For the programmer

The object applyToCoefficients is a method function with options.