Work function of metals: Relation between theory and experiment