Accurate calculation of friction in tubes, channels, and oscillatory flow : A unified formulation