def sum(x, weights=None):
x = to_potential(x)<EOL>if is_const_potential(x): return PotentialConstant(np.sum(x.c))<EOL>else:                     return PotentialSum(x, weights=weights)<EOL>
sum(x) yields either a potential-sum object if x is a potential function or the sum of x if x
  is not. If x is not a potential-field then it must be a vector.
sum(x, weights=w) uses the given weights to produce a weighted sum.