#NEWLINE# def dup_integrate( f , m , K ) : #NEWLINE# #INDENT# '\n    Computes the indefinite integral of ``f`` in ``K[x]``.\n\n    Examples\n    ========\n\n    >>> from sympy.polys import ring, QQ\n    >>> R, x = ring("x", QQ)\n\n    >>> R.dup_integrate(x**2 + 2*x, 1)\n    1/3*x**3 + x**2\n    >>> R.dup_integrate(x**2 + 2*x, 2)\n    1/12*x**4 + 1/3*x**3\n\n    ' #NEWLINE# if ( ( m <= 0 ) or ( not f ) ) : #NEWLINE# #INDENT# return f #NEWLINE# #UNINDENT# g = ( [ K . zero ] * m ) #NEWLINE# for ( i , c ) in enumerate ( reversed ( f ) ) : #NEWLINE# #INDENT# n = ( i + 1 ) #NEWLINE# for j in range ( 1 , m ) : #NEWLINE# #INDENT# n *= ( ( i + j ) + 1 ) #NEWLINE# #UNINDENT# g . insert ( 0 , K . exquo ( c , K ( n ) ) ) #NEWLINE# #UNINDENT# return g