#NEWLINE# @ staticmethod #NEWLINE# def _bell_incomplete_poly( n , k , symbols ) : #NEWLINE# #INDENT# '\n        The second kind of Bell polynomials (incomplete Bell polynomials).\n\n        Calculated by recurrence formula:\n\n        .. math:: B_{n,k}(x_1, x_2, \\dotsc, x_{n-k+1}) =\n                \\sum_{m=1}^{n-k+1}\n                \\x_m \\binom{n-1}{m-1} B_{n-m,k-1}(x_1, x_2, \\dotsc, x_{n-m-k})\n\n        where\n            B_{0,0} = 1;\n            B_{n,0} = 0; for n>=1\n            B_{0,k} = 0; for k>=1\n\n        ' #NEWLINE# if ( ( n == 0 ) and ( k == 0 ) ) : #NEWLINE# #INDENT# return S . One #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( n == 0 ) or ( k == 0 ) ) : #NEWLINE# #INDENT# return S . Zero #NEWLINE# #UNINDENT# #UNINDENT# s = S . Zero #NEWLINE# a = S . One #NEWLINE# for m in range ( 1 , ( ( n - k ) + 2 ) ) : #NEWLINE# #INDENT# s += ( ( a * bell . _bell_incomplete_poly ( ( n - m ) , ( k - 1 ) , symbols ) ) * symbols [ ( m - 1 ) ] ) #NEWLINE# a = ( ( a * ( n - m ) ) / m ) #NEWLINE# #UNINDENT# return expand_mul ( s )