python实现最速下降法求二元函数极值并绘制3D图像_python二维函数最速下降法显示过程点-CSDN博客

网站介绍:文章浏览阅读2k次,点赞3次,收藏17次。目标原函数: f(x) = 2x1x1 + x2x2 -2x1*x2 - 4x1 + 4起始点 为(0,0)精度 :误差要求小于 10**(-3)过程:直接上代码看注释吧()import numpy as npimport mathimport matplotlib.pyplot as pltfrom mpl_toolkits.mplot3d import Axes3Ddef f(x): return 2*x[0]**2 + x[1]**2 - 2*x[0]*x[1]-4*_python二维函数最速下降法显示过程点