(f, g, p, K)
return h
Compute polynomial composition ``f(g)`` in ``GF(p)[x]``.

    Examples
    ========

    >>> from sympy.polys.domains import ZZ
    >>> from sympy.polys.galoistools import gf_compose

    >>> gf_compose([3, 2, 4], [2, 2, 2], 5, ZZ)
    [2, 4, 0, 3, 0]
Compute polynomial composition ``f(g)`` in ``GF(p)[x]``.
Compute polynomial composition f ( g ) in GF ( p ) [ x ] .
def gf_compose(f, g, p, K):
    """
    Compute polynomial composition ``f(g)`` in ``GF(p)[x]``.

    Examples
    ========

    >>> from sympy.polys.domains import ZZ
    >>> from sympy.polys.galoistools import gf_compose

    >>> gf_compose([3, 2, 4], [2, 2, 2], 5, ZZ)
    [2, 4, 0, 3, 0]

    """
    if len(g) <= 1:
        return gf_strip([gf_eval(f, gf_LC(g, K), p, K)])

    if not f:
        return []

    h = [f[0]]

    for c in f[1:]:
        h = gf_mul(h, g, p, K)
        h = gf_add_ground(h, c, p, K)

    return h
def gf_compose ( f , g , p , K ) : if len ( g ) <= 1 : return gf_strip ( [ gf_eval ( f , gf_LC ( g , K ) , p , K ) ] ) if not f : return [ ] h = [ f [ 0 ] ] for c in f [ 1 : ] : h = gf_mul ( h , g , p , K ) h = gf_add_ground ( h , c , p , K ) return h