function P1 = divide_by_potential(P1, P2)
% DIVIDE_BY_POTENTIAL (Dispatch) Compute P1 /= P2 for a generic potential.
% P1 = divide_by_potential(P1, P2)

switch P1.type
  case 'd',
    P1 = divide_by_table(P1, P2);
  case 'm',
    P1 = divide_by_max_table(P1, P2);
  case 'g',
    P1 = divide_by_gpot(P1, P2);
  case 'cg',
    P1 = divide_by_cgpot(P1, P2);
  otherwise
    error(['bad type ' P1.type]);
end
