steepest descent method python code