contract

usage: contract(m, n) -- contract the matrix n by the matrix m

This function is identical to diff, except that contraction is used instead of differentiation. This means for example that x^3 contracted by x^2 is x, not 6 x. For example,

     i1 = R = ZZ/101[a..c]
     
     o1 = R
     
     o1 : PolynomialRing
     
     i2 = diff(transpose matrix {{a,b,c}}, matrix {{(a+b+c)^3, a^2 * b^3 * c^2}})
     
     o2 = | 3a2+6ab+3b2+6ac+6bc+3c2 2ab3c2  |
          | 3a2+6ab+3b2+6ac+6bc+3c2 3a2b2c2 |
          | 3a2+6ab+3b2+6ac+6bc+3c2 2a2b3c  |
     
                  3       2
     o2 : Matrix R  <--- R
     

As another example, the Sylvester resultant between homogeneous polynomials f(x,y) and g(x,y) can be found in the following way.

     i3 = R = (ZZ/101[a,b])[x,y]
     
     o3 = R
     
     o3 : PolynomialRing
     
     i4 = f = a * x^3 + b * x^2 * y + y^3
     
             3      2      3
     o4 = a x  + b x  y + y 
     
     o4 : R
     
     i5 = g = b * x^3 + a * x * y^2 + y^3
     
             3        2    3
     o5 = b x  + a x y  + y 
     
     o5 : R
     
Multiply each of these by all quadrics, obtaining a set of elements in degree 5:
     i6 = n = matrix {{f,g}} ** symmetricPower(2,vars R)
     
     o6 = | ax5+bx4y+x2y3 ax4y+bx3y2+xy4 ax3y2+bx2y3+y5 bx5+ax3y2+x2y3 bx4y+ax2y3+xy4 bx3y2+axy4+y5 |
     
                  1       6
     o6 : Matrix R  <--- R
     
Now create the matrix of coefficients by using contract against all monomials of degree 5 in x and y.
     i7 = M = contract(transpose symmetricPower(5,vars R), n)
     
     o7 = | a 0 0 b 0 0 |
          | b a 0 0 b 0 |
          | 0 b a a 0 b |
          | 1 0 b 1 a 0 |
          | 0 1 0 0 1 a |
          | 0 0 1 0 0 1 |
     
                  6       6
     o7 : Matrix R  <--- R
     
     i8 = Resfg = minors(6, M)
     
     o8 = ideal | -a5-a2b3-a3b-a2b2+2ab3-b4+a3-3a2b+3ab2-b3 |
     
     o8 : Ideal
     

See also diff.

Go to main index.

Go to concepts index.