We develop a generalized gradient expansion of the inhomogeneous dynamical mean-field theory method for determining properties of ultracold atoms in a trap. This approach goes beyond the well-known local density approximation and at higher temperatures, in the normal phase, it shows why the local density approximation works so well, since the local density and generalized gradient approximation...