예제 #1
0
    def expand(self):
        """
        EXAMPLES::

            sage: X = SchubertPolynomialRing(ZZ)
            sage: X([2,1,3]).expand()
            x0
            sage: map(lambda x: x.expand(), [X(p) for p in Permutations(3)])
            [1, x0 + x1, x0, x0*x1, x0^2, x0^2*x1]

        TESTS: Calling .expand() should always return an element of an
        MPolynomialRing

        ::

            sage: X = SchubertPolynomialRing(ZZ)
            sage: f = X([1]); f
            X[1]
            sage: type(f.expand())
            <type 'sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular'>
            sage: f.expand()
            1
            sage: f = X([1,2])
            sage: type(f.expand())
            <type 'sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular'>
            sage: f = X([1,3,2,4])
            sage: type(f.expand())
            <type 'sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular'>
        """
        p = symmetrica.t_SCHUBERT_POLYNOM(self)
        if not is_MPolynomial(p):
            R = PolynomialRing(self.parent().base_ring(), 1, 'x')
            p = R(p)
        return p
예제 #2
0
 def expand(self):
     """
     EXAMPLES::
     
         sage: X = SchubertPolynomialRing(ZZ)
         sage: X([2,1,3]).expand()
         x0
         sage: map(lambda x: x.expand(), [X(p) for p in Permutations(3)])
         [1, x0 + x1, x0, x0*x1, x0^2, x0^2*x1]
     
     TESTS: Calling .expand() should always return an element of an
     MPolynomialRing
     
     ::
     
         sage: X = SchubertPolynomialRing(ZZ)
         sage: f = X([1]); f
         X[1]
         sage: type(f.expand())
         <type 'sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular'>
         sage: f.expand()
         1
         sage: f = X([1,2])
         sage: type(f.expand())
         <type 'sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular'>
         sage: f = X([1,3,2,4])
         sage: type(f.expand())
         <type 'sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular'>
     """
     p = symmetrica.t_SCHUBERT_POLYNOM(self)
     if not is_MPolynomial(p):
         R = PolynomialRing(self.parent().base_ring(), 1, 'x')
         p = R(p)
     return p