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
Computes partial derivative in ``x``.
dataset/ETHPy150Open sympy/sympy/sympy/polys/rings.py/PolyElement.diff