Extrapolation algorithm pseuocode.