compute slope