# intersectInP -- Compute distinguished varieties for an intersection in A^n or P^n

## Description

This function applies the technology of distinguished to compute the distinguished subvarieties, with their multiplicities, for an intersection in affine or projective space. The function distinguished is actually applied to the diagonal ideal in P**P and the ideal I**P + P**I, and the answer is pulled back to P.

 ```i1 : kk = ZZ/101 o1 = kk o1 : QuotientRing``` ```i2 : P = kk[x,y] o2 = P o2 : PolynomialRing``` ```i3 : I = ideal"x2-y";J=ideal y o3 : Ideal of P o4 = ideal y o4 : Ideal of P``` ```i5 : intersectInP(I,J) o5 = {{2, ideal (y, x)}} o5 : List``` ```i6 : I = ideal"x4+y3+1" 4 3 o6 = ideal(x + y + 1) o6 : Ideal of P``` ```i7 : intersectInP(I,J) 2 2 o7 = {{1, ideal (y, x + 10)}, {1, ideal (y, x - 10)}} o7 : List``` ```i8 : I = ideal"x2y";J=ideal"xy2" o8 : Ideal of P 2 o9 = ideal(x*y ) o9 : Ideal of P``` ```i10 : intersectInP(I,J) o10 = {{2, ideal x}, {5, ideal (y, x)}, {2, ideal y}} o10 : List``` ```i11 : intersectInP(I,I) o11 = {{1, ideal y}, {4, ideal x}, {4, ideal (y, x)}} o11 : List```

Note that in the last two cases, which are improper intersections of two cubics, the total multiplicity is 9 = 3*3. But this is not always the case (in the actual definition of the intersection product, the multiplicity is multiplied by the class of a certain cycle supported on the distinguished subvariety).

 ```i12 : I = ideal"y-x2" 2 o12 = ideal(- x + y) o12 : Ideal of P``` ```i13 : intersectInP(I,I) 2 o13 = {{1, ideal(x - y)}} o13 : List```