高等数学拾遗01——–Hesse矩阵与多元函数的极值

  • 必要条件:若函数fx^0\in D^0处取极值,则有gradf=0
  • 其中x^0称为函数的稳定点
  • 稳定点 鞍点  fx^0处的Hesse矩阵是不定的 极值点 x^0是一个极小值点,那么fx^0处的Hesse矩阵是半正定的x^0是一个极大值点,那么fx^0处的Hesse矩阵是半负定的fx^0处的Hesse矩阵是正定的, x^0是一个严格的极小值点 fx^0处的Hesse矩阵是负定的, x^0是一个严格的极大值点
  • Hesse矩阵 f(x_{1},x_{2},x_{3},...,x_{n})X^{(0)}点处的泰勒展开式的矩阵形式 f(X)=f(X^{(0)})+\bigtriangledown f(X^{0})^{T}\Delta X+\frac{1}{2}\Delta X^{T}G(X^{(0)})\Delta X+... G(X^{(0)})=\begin{bmatrix} \frac{\partial ^{2}f}{\partial x_{1}^2} & \frac{\partial ^{2}f}{\partial x_{1}\partial x_{2}} & \cdots &\frac{\partial ^{2}f}{\partial x_{1}\partial x_{n}} \\ \frac{\partial ^2 f}{\partial x_2\partial x_1} & \frac{\partial ^{2f}}{\partial x_2^2} &\cdots &\frac{\partial ^{2f}}{\partial x_2\partial x_n} \\ \vdots & \vdots & \ddots & \vdots \\ \frac{\partial ^2 f}{\partial x_n\partial x_1} & \frac{\partial ^2f}{\partial x_n\partial x_2} &\cdots & \frac{\partial ^2 f}{\partial x_n^2} \end{bmatrix}\rightarrow Hesse -Matrix
  • Numpy 求矩阵的特征值并做判断
    import numpy as np
    a = [[1,0,0],[-2,5,-2],[-2,4,-1]]
    c = np.linalg.eig(a)
    eig_values = c[0]
    p = list(c[0])
    positive = 0 
    negative = 0
    null = 0
    
    for i in p:
        if i > 0:
            positive += 1
        elif i == 0"
            null += 1
        elif i < 0:
            negative += 1       
    if negative > 0 and positive > 0:
        print("it is a saddle point")
    elif negative > 0 and positive = 0 and null > 0:
        print("it is a negative semidefinite matrix")
        print("Warning!!cannot judge!!")
    elif negative > 0 and positive = 0 and null = 0:
        print("it is a maximum point")
    elif negative = 0 and positive > 0 and null = 0:
        print("it is a minmum point")
    elif negative = 0 and positive > 0 and null > 0:
        print("it is a positive semidefinite matrix")
        print("Warning!!cannot judge!!")
        
    
    import numpy as np a = [[1,0,0],[-2,5,-2],[-2,4,-1]] c = np.linalg.eig(a) eig_values = c[0] p = list(c[0]) positive = 0 negative = 0 null = 0 for i in p: if i > 0: positive += 1 elif i == 0″ null += 1 elif i < 0: negative += 1 if negative > 0 and positive > 0: print(“it is a saddle point”) elif negative > 0 and positive = 0 and null > 0: print(“it is a negative semidefinite matrix”) print(“Warning!!cannot judge!!”) elif negative > 0 and positive = 0 and null = 0: print(“it is a maximum point”) elif negative = 0 and positive > 0 and null = 0: print(“it is a minmum point”) elif negative = 0 and positive > 0 and null > 0: print(“it is a positive semidefinite matrix”) print(“Warning!!cannot judge!!”)

文章出处登录后可见!

已经登录?立即刷新

共计人评分,平均

到目前为止还没有投票!成为第一位评论此文章。

(0)
青葱年少的头像青葱年少普通用户
上一篇 2022年5月9日
下一篇 2022年5月9日

相关推荐