Lagrange 乘子法求最優解

clc clear syms x y z r1 r2 w f=x^2+y^2+z^2+w^2; g1=2*x-y+z-w-1; g2=x+y-z+w-1; h=f-r1*g1 -r2*g2; hx=diff(h,x); hy=diff(h,y); hz=diff(h,z); hw=diff(h,w); hr1=diff(h,r1); hr2=diff(h,r2); r=solve([hx==
相關文章
相關標籤/搜索