# BasicDivisor + BasicDivisor -- add or subtract two divisors, or negate a divisor

## Description

We can add or subtract two divisors:

 i1 : R = QQ[x, y, z]; i2 : D1 = divisor({1, 3, 2}, {ideal(x), ideal(y), ideal(z)}) o2 = Div(x) + 3*Div(y) + 2*Div(z) o2 : WeilDivisor on R i3 : D2 = divisor({-2, 3, -5}, {ideal(z), ideal(y), ideal(x)}) o3 = -5*Div(x) + -2*Div(z) + 3*Div(y) o3 : WeilDivisor on R i4 : D1 + D2 o4 = -4*Div(x) + 6*Div(y) o4 : WeilDivisor on R i5 : D1 - D2 o5 = 6*Div(x) + 4*Div(z) o5 : WeilDivisor on R

We can also add or subtract divisors with different coefficients.

 i6 : R = QQ[x,y]; i7 : D1 = divisor({3, 1}, {ideal(x), ideal(y)}) o7 = 3*Div(x) + Div(y) o7 : WeilDivisor on R i8 : D2 = divisor({3/2, -1}, {ideal(x), ideal(y)}, CoefficientType=>QQ) o8 = 3/2*Div(x) + -Div(y) o8 : QWeilDivisor on R i9 : D3 = divisor({1.25}, {ideal(x)}, CoefficientType=>RR) o9 = 1.25*Div(x) o9 : RWeilDivisor on R i10 : D1+D2 o10 = 9/2*Div(x) o10 : QWeilDivisor on R i11 : D1+D3 o11 = Div(y) + 4.25*Div(x) o11 : RWeilDivisor on R i12 : D2+D3 o12 = -Div(y) + 2.75*Div(x) o12 : RWeilDivisor on R

Finally, we can negate a divisor.

 i13 : R = ZZ/3[x,y,z]/ideal(x^2-y*z); i14 : D = divisor({3, 0, -1}, {ideal(x,z), ideal(y,z), ideal(x-y, x-z)}) o14 = 0*Div(y, z) + -Div(x-y, x-z) + 3*Div(x, z) o14 : WeilDivisor on R i15 : -D o15 = Div(x-y, x-z) + -3*Div(x, z) o15 : WeilDivisor on R i16 : E = divisor({3/2, -2/3}, {ideal(x, z), ideal(y, z)}) o16 = -2/3*Div(y, z) + 3/2*Div(x, z) o16 : WeilDivisor on R i17 : -E o17 = 2/3*Div(y, z) + -3/2*Div(x, z) o17 : WeilDivisor on R