梯度下降和梯度上升的算法实现-----------------------------------------------------------------------