(f, g, u, K)
return dmp_strip(h, u)
Multiply dense polynomials in ``K[X]``.

    Examples
    ========

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

    >>> R.dmp_mul(x*y + 1, x)
    x**2*y + x
Multiply dense polynomials in ``K[X]``.
Multiply dense polynomials in K [ X ] .
def dmp_mul(f, g, u, K):
    """
    Multiply dense polynomials in ``K[X]``.

    Examples
    ========

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

    >>> R.dmp_mul(x*y + 1, x)
    x**2*y + x

    """
    if not u:
        return dup_mul(f, g, K)

    if f == g:
        return dmp_sqr(f, u, K)

    df = dmp_degree(f, u)

    if df < 0:
        return f

    dg = dmp_degree(g, u)

    if dg < 0:
        return g

    h, v = [], u - 1

    for i in xrange(0, df + dg + 1):
        coeff = dmp_zero(v)

        for j in xrange(max(0, i - dg), min(df, i) + 1):
            coeff = dmp_add(coeff, dmp_mul(f[j], g[i - j], v, K), v, K)

        h.append(coeff)

    return dmp_strip(h, u)
def dmp_mul ( f , g , u , K ) : if not u : return dup_mul ( f , g , K ) if f == g : return dmp_sqr ( f , u , K ) df = dmp_degree ( f , u ) if df < 0 : return f dg = dmp_degree ( g , u ) if dg < 0 : return g h , v = [ ] , u - 1 for i in xrange ( 0 , df + dg + 1 ) : coeff = dmp_zero ( v ) for j in xrange ( max ( 0 , i - dg ) , min ( df , i ) + 1 ) : coeff = dmp_add ( coeff , dmp_mul ( f [ j ] , g [ i - j ] , v , K ) , v , K ) h . append ( coeff ) return dmp_strip ( h , u )