Extended Mermin method for calculating the electron inelastic mean free path.