(f, g, *gens, **args)
Compute functional composition ``f(g)``.

    Examples
    ========

    >>> from sympy import compose
    >>> from sympy.abc import x

    >>> compose(x**2 + x, x - 1)
    x**2 - x
Compute functional composition ``f(g)``.
Compute functional composition f ( g ) .
def compose(f, g, *gens, **args):
    """
    Compute functional composition ``f(g)``.

    Examples
    ========

    >>> from sympy import compose
    >>> from sympy.abc import x

    >>> compose(x**2 + x, x - 1)
    x**2 - x

    """
    options.allowed_flags(args, ['polys'])

    try:
        (F, G), opt = parallel_poly_from_expr((f, g), *gens, **args)
    except PolificationFailed as exc:
        raise ComputationFailed('compose', 2, exc)

    result = F.compose(G)

    if not opt.polys:
        return result.as_expr()
    else:
        return result
def compose ( f , g , * gens , * * args ) : options . allowed_flags ( args , [ 'polys' ] ) try : ( F , G ) , opt = parallel_poly_from_expr ( ( f , g ) , * gens , * * args ) except PolificationFailed as exc : raise ComputationFailed ( 'compose' , 2 , exc ) result = F . compose ( G ) if not opt . polys : return result . as_expr ( ) else : return result