def _atomic(e):
 from sympy import Derivative, Function, Symbol
 pot = preorder_traversal(e)
 seen = set()
 try:
  free = e.free_symbols
 except AttributeError:
  return {e}
 atoms = set()
 for p in pot:
  if (p in seen):
   pot.skip()
   continue
  seen.add(p)
  if (isinstance(p, Symbol) and (p in free)):
   atoms.add(p)
  elif isinstance(p, (Derivative, Function)):
   pot.skip()
   atoms.add(p)
 return atoms

def _atomic ( e ) : from sympy import Derivative , Function , Symbol pot = preorder_traversal ( e ) seen = set ( ) try : free = e . free_symbols except AttributeError : return { e } atoms = set ( ) for p in pot : if ( p in seen ) : pot . skip ( ) continue seen . add ( p ) if ( isinstance ( p , Symbol ) and ( p in free ) ) : atoms . add ( p ) elif isinstance ( p , ( Derivative , Function ) ) : pot . skip ( ) atoms . add ( p ) return atoms
return atom-like quantities as far as substitution is concerned: derivatives .