#NEWLINE# def _pow_multinomial( self , n ) : #NEWLINE# #INDENT# multinomials = list ( multinomial_coefficients ( len ( self ) , n ) . items ( ) ) #NEWLINE# monomial_mulpow = self . ring . monomial_mulpow #NEWLINE# zero_monom = self . ring . zero_monom #NEWLINE# terms = list ( self . iterterms ( ) ) #NEWLINE# zero = self . ring . domain . zero #NEWLINE# poly = self . ring . zero #NEWLINE# for ( multinomial , multinomial_coeff ) in multinomials : #NEWLINE# #INDENT# product_monom = zero_monom #NEWLINE# product_coeff = multinomial_coeff #NEWLINE# for ( exp , ( monom , coeff ) ) in zip ( multinomial , terms ) : #NEWLINE# #INDENT# if exp : #NEWLINE# #INDENT# product_monom = monomial_mulpow ( product_monom , monom , exp ) #NEWLINE# product_coeff *= ( coeff ** exp ) #NEWLINE# #UNINDENT# #UNINDENT# monom = tuple ( product_monom ) #NEWLINE# coeff = product_coeff #NEWLINE# coeff = ( poly . get ( monom , zero ) + coeff ) #NEWLINE# if coeff : #NEWLINE# #INDENT# poly [ monom ] = coeff #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# del poly [ monom ] #NEWLINE# #UNINDENT# #UNINDENT# return poly