def sum_combine(s_t):
 from sympy.concrete.summations import Sum
 used = ([False] * len(s_t))
 for method in range(2):
  for (i, s_term1) in enumerate(s_t):
   if (not used[i]):
    for (j, s_term2) in enumerate(s_t):
     if ((not used[j]) and (i != j)):
      temp = sum_add(s_term1, s_term2, method)
      if (isinstance(temp, Sum) or isinstance(temp, Mul)):
       s_t[i] = temp
       s_term1 = s_t[i]
       used[j] = True
 result = S.Zero
 for (i, s_term) in enumerate(s_t):
  if (not used[i]):
   result = Add(result, s_term)
 return result

def sum_combine ( s_t ) : from sympy . concrete . summations import Sum used = ( [ False ] * len ( s_t ) ) for method in range ( 2 ) : for ( i , s_term1 ) in enumerate ( s_t ) : if ( not used [ i ] ) : for ( j , s_term2 ) in enumerate ( s_t ) : if ( ( not used [ j ] ) and ( i != j ) ) : temp = sum_add ( s_term1 , s_term2 , method ) if ( isinstance ( temp , Sum ) or isinstance ( temp , Mul ) ) : s_t [ i ] = temp s_term1 = s_t [ i ] used [ j ] = True result = S . Zero for ( i , s_term ) in enumerate ( s_t ) : if ( not used [ i ] ) : result = Add ( result , s_term ) return result
helper function for sum simplification attempts to simplify a list of sums .