def piecewise(dflt, *spec):
return PotentialPiecewise(dflt, *spec)<EOL>
piecewise(g, ((mn1, mx1), f1), ((mn2, mx2), f2), ...) yields a potential function f(x) that, for
  each value x[i] in x, calculate y[i] = f1(x[i]) if mn1 <= x[i] <= mx1 else f2(x[i]) if mn2 <=
  x[i] <= mx2 else ... else g(x[i]).

The ((mn,mx), f) may alternately be specified (mn,mx,f).