def dup_scale(f, a, K):
    f, n, b = list(f), len(f) - 1, a

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

    return f
Evaluate efficiently composition ``f(a*x)`` in ``K[x]``.
dataset/ETHPy150Open sympy/sympy/sympy/polys/densetools.py/dup_scale