(f, K)
return f
Evaluate efficiently the composition ``f(-x)`` in ``K[x]``.

    Examples
    ========

    >>> from sympy.polys import ring, ZZ
    >>> R, x = ring("x", ZZ)

    >>> R.dup_mirror(x**3 + 2*x**2 - 4*x + 2)
    -x**3 + 2*x**2 + 4*x + 2
Evaluate efficiently the composition ``f(-x)`` in ``K[x]``.
Evaluate efficiently the composition f ( - x ) in K [ x ] .
def dup_mirror(f, K):
    """
    Evaluate efficiently the composition ``f(-x)`` in ``K[x]``.

    Examples
    ========

    >>> from sympy.polys import ring, ZZ
    >>> R, x = ring("x", ZZ)

    >>> R.dup_mirror(x**3 + 2*x**2 - 4*x + 2)
    -x**3 + 2*x**2 + 4*x + 2

    """
    f, n, a = list(f), len(f) - 1, -K.one

    for i in xrange(n - 1, -1, -1):
        f[i], a = a*f[i], -a

    return f
def dup_mirror ( f , K ) : f , n , a = list ( f ) , len ( f ) - 1 , - K . one for i in xrange ( n - 1 , - 1 , - 1 ) : f [ i ] , a = a * f [ i ] , - a return f