(self, n)
raise polynomial to power `n`

        Examples
        --------
        >>> from sympy.polys.domains import ZZ
        >>> from sympy.polys.rings import ring

        >>> _, x, y = ring('x, y', ZZ)
        >>> p = x + y**2
        >>> p**3
        x**3 + 3*x**2*y**2 + 3*x*y**4 + y**6
raise polynomial to power `n`
raise polynomial to power n
def __pow__(self, n):
        """raise polynomial to power `n`

        Examples
        --------
        >>> from sympy.polys.domains import ZZ
        >>> from sympy.polys.rings import ring

        >>> _, x, y = ring('x, y', ZZ)
        >>> p = x + y**2
        >>> p**3
        x**3 + 3*x**2*y**2 + 3*x*y**4 + y**6

        """
        ring = self.ring
        n = int(n)

        if n < 0:
            raise ValueError("negative exponent")
        elif not n:
            if self:
                return ring.one
            else:
                raise ValueError("0**0")
        elif len(self) == 1:
            monom, coeff = list(self.items())[0]
            p = ring.zero
            p[ring.monomial_pow(monom, n)] = coeff**n
            return p
        elif n == 1:
            return self.copy()
        elif n == 2:
            return self.square()
        elif n == 3:
            return self*self.square()
        elif len(self) <= 5: # TODO: use an actuall density measure
            return self._pow_multinomial(n)
        else:
            return self._pow_generic(n)
def __pow__ ( self , n ) : ring = self . ring n = int ( n ) if n < 0 : raise ValueError ( "negative exponent" ) elif not n : if self : return ring . one else : raise ValueError ( "0**0" ) elif len ( self ) == 1 : monom , coeff = list ( self . items ( ) ) [ 0 ] p = ring . zero p [ ring . monomial_pow ( monom , n ) ] = coeff ** n return p elif n == 1 : return self . copy ( ) elif n == 2 : return self . square ( ) elif n == 3 : return self * self . square ( ) elif len ( self ) <= 5 : # TODO: use an actuall density measure return self . _pow_multinomial ( n ) else : return self . _pow_generic ( n )