On the calculation of induced electric and magnetic moments of atoms and molecules