(f, x)
return g
Computes partial derivative in ``x``.

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

        >>> _, x, y = ring("x,y", ZZ)
        >>> p = x + x**2*y**3
        >>> p.diff(x)
        2*x*y**3 + 1
Computes partial derivative in ``x``.
Computes partial derivative in x .
def diff(f, x):
        """Computes partial derivative in ``x``.

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

        >>> _, x, y = ring("x,y", ZZ)
        >>> p = x + x**2*y**3
        >>> p.diff(x)
        2*x*y**3 + 1

        """
        ring = f.ring
        i = ring.index(x)
        m = ring.monomial_basis(i)
        g = ring.zero
        for expv, coeff in f.iterterms():
            if expv[i]:
                e = ring.monomial_ldiv(expv, m)
                g[e] = coeff*expv[i]
        return g
def diff ( f , x ) : ring = f . ring i = ring . index ( x ) m = ring . monomial_basis ( i ) g = ring . zero for expv , coeff in f . iterterms ( ) : if expv [ i ] : e = ring . monomial_ldiv ( expv , m ) g [ e ] = coeff * expv [ i ] return g