Theory of nonuniform electronic systems. I. Analysis of the gradient approximation and a generalization that works | Synapse