def exclude(f):
        """
        Remove unnecessary generators from ``f``.

        Examples
        ========

        >>> from sympy import Poly
        >>> from sympy.abc import a, b, c, d, x

        >>> Poly(a + x, a, b, c, d, x).exclude()
        Poly(a + x, a, x, domain='ZZ')

        """
        J, new = f.rep.exclude()
        gens = []

        for j in range(len(f.gens)):
            if j not in J:
                gens.append(f.gens[j])

        return f.per(new, gens=gens)
dataset/ETHPy150Open sympy/sympy/sympy/polys/polytools.py/Poly.exclude/original