Exemple #1
0
    def scalar_product(self, x):
        """
        Returns the standard scalar product of self and x.

        EXAMPLES::

            sage: X = SchubertPolynomialRing(ZZ)
            sage: a = X([3,2,4,1])
            sage: a.scalar_product(a)
            0
            sage: b = X([4,3,2,1])
            sage: b.scalar_product(a)
            X[1, 3, 4, 6, 2, 5]
            sage: Permutation([1, 3, 4, 6, 2, 5, 7]).to_lehmer_code()
            [0, 1, 1, 2, 0, 0, 0]
            sage: s = SymmetricFunctions(ZZ).schur()
            sage: c = s([2,1,1])
            sage: b.scalar_product(a).expand()
            x0^2*x1*x2 + x0*x1^2*x2 + x0*x1*x2^2 + x0^2*x1*x3 + x0*x1^2*x3 + x0^2*x2*x3 + 3*x0*x1*x2*x3 + x1^2*x2*x3 + x0*x2^2*x3 + x1*x2^2*x3 + x0*x1*x3^2 + x0*x2*x3^2 + x1*x2*x3^2
            sage: c.expand(4)
            x0^2*x1*x2 + x0*x1^2*x2 + x0*x1*x2^2 + x0^2*x1*x3 + x0*x1^2*x3 + x0^2*x2*x3 + 3*x0*x1*x2*x3 + x1^2*x2*x3 + x0*x2^2*x3 + x1*x2^2*x3 + x0*x1*x3^2 + x0*x2*x3^2 + x1*x2*x3^2
        """
        if is_SchubertPolynomial(x):
            return symmetrica.scalarproduct_schubert(self, x)
        else:
            raise TypeError, "x must be a Schubert polynomial"
 def scalar_product(self, x):
     """
     Returns the standard scalar product of self and x.
     
     EXAMPLES::
     
         sage: X = SchubertPolynomialRing(ZZ)
         sage: a = X([3,2,4,1])
         sage: a.scalar_product(a)
         0
         sage: b = X([4,3,2,1])
         sage: b.scalar_product(a)
         X[1, 3, 4, 6, 2, 5]
         sage: Permutation([1, 3, 4, 6, 2, 5, 7]).to_lehmer_code()
         [0, 1, 1, 2, 0, 0, 0]
         sage: s = SFASchur(ZZ)
         sage: c = s([2,1,1])
         sage: b.scalar_product(a).expand()
         x0^2*x1*x2 + x0*x1^2*x2 + x0*x1*x2^2 + x0^2*x1*x3 + x0*x1^2*x3 + x0^2*x2*x3 + 3*x0*x1*x2*x3 + x1^2*x2*x3 + x0*x2^2*x3 + x1*x2^2*x3 + x0*x1*x3^2 + x0*x2*x3^2 + x1*x2*x3^2
         sage: c.expand(4)
         x0^2*x1*x2 + x0*x1^2*x2 + x0*x1*x2^2 + x0^2*x1*x3 + x0*x1^2*x3 + x0^2*x2*x3 + 3*x0*x1*x2*x3 + x1^2*x2*x3 + x0*x2^2*x3 + x1*x2^2*x3 + x0*x1*x3^2 + x0*x2*x3^2 + x1*x2*x3^2
     """
     if is_SchubertPolynomial(x):
         return symmetrica.scalarproduct_schubert(self, x)
     else:
         raise TypeError, "x must be a Schubert polynomial"