#NEWLINE# def dup_decompose( f , K ) : #NEWLINE# #INDENT# '\n    Computes functional decomposition of ``f`` in ``K[x]``.\n\n    Given a univariate polynomial ``f`` with coefficients in a field of\n    characteristic zero, returns list ``[f_1, f_2, ..., f_n]``, where::\n\n              f = f_1 o f_2 o ... f_n = f_1(f_2(... f_n))\n\n    and ``f_2, ..., f_n`` are monic and homogeneous polynomials of at\n    least second degree.\n\n    Unlike factorization, complete functional decompositions of\n    polynomials are not unique, consider examples:\n\n    1. ``f o g = f(x + b) o (g - b)``\n    2. ``x**n o x**m = x**m o x**n``\n    3. ``T_n o T_m = T_m o T_n``\n\n    where ``T_n`` and ``T_m`` are Chebyshev polynomials.\n\n    Examples\n    ========\n\n    >>> from sympy.polys import ring, ZZ\n    >>> R, x = ring("x", ZZ)\n\n    >>> R.dup_decompose(x**4 - 2*x**3 + x**2)\n    [x**2, x**2 - x]\n\n    References\n    ==========\n\n    1. [Kozen89]_\n\n    ' #NEWLINE# F = [ ] #NEWLINE# while True : #NEWLINE# #INDENT# result = _dup_decompose ( f , K ) #NEWLINE# if ( result is not None ) : #NEWLINE# #INDENT# ( f , h ) = result #NEWLINE# F = ( [ h ] + F ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# return ( [ f ] + F )