Given a divisor with rational or real coefficients, but whose coefficients are actually integers, we first check if all coefficients are integers. If so we make this Weil divisor. Otherwise, an error is thrown.
i1 : R=QQ[x]; |
i2 : D=divisor({3/2}, {ideal(x)}, CoefficientType=>QQ) o2 = 3/2*Div(x) o2 : QWeilDivisor on R |
i3 : E=divisor({1.5}, {ideal(x)}, CoefficientType=>RR) o3 = 1.5*Div(x) o3 : RWeilDivisor on R |
i4 : toWeilDivisor(2*D) o4 = 3*Div(x) o4 : WeilDivisor on R |
i5 : toWeilDivisor(2*E) o5 = 3*Div(x) o5 : WeilDivisor on R |
i6 : isWeilDivisor(D) o6 = false |
i7 : try toWeilDivisor(D) then print "converted to a WeilDivisor" else print "can't be converted to a WeilDivisor" can't be converted to a WeilDivisor |
Notice in the final computation, D cannot be converted into a Weil divisor since $D$ has non-integer coefficients, but 2*D can be converted into a Weil divisor.
The object toWeilDivisor is a method function.