@cacheit
def _is_simple_delta(delta, index):
 if (isinstance(delta, KroneckerDelta) and delta.has(index)):
  p = (delta.args[0] - delta.args[1]).as_poly(index)
  if p:
   return (p.degree() == 1)
 return False

@ cacheit def _is_simple_delta ( delta , index ) : if ( isinstance ( delta , KroneckerDelta ) and delta . has ( index ) ) : p = ( delta . args [ 0 ] - delta . args [ 1 ] ) . as_poly ( index ) if p : return ( p . degree ( ) == 1 ) return False
returns true if delta is a kroneckerdelta and is nonzero for a single value of the index index .