Wave functions for two- and three-electron atoms and isoelectronic ions