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

## Synopsis

• Usage:
applyToCoefficients(D1, h)
• Inputs:
• Optional inputs:
• CoefficientType => , default value null, specifies what the coefficients of the output divisor should be
• Safe => , default value false, specifies that the system checks whether the output is a valid divisor
• Outputs:

## Description

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