Nowy lgr

1371 days ago by Henryk

x, y, z, lam1, lam2 = var('x, y, z, lam1, lam2') f = 4*y-2*z g1 = x^2+y^2-13 g2 = 2*x-y-z-4 h = f - g1 * lam1 - g2 * lam2 
       
gradh = h.gradient([x, y, z, lam1, lam2]) critical = solve([gradh[0] == 0, gradh[1] == 0, gradh[2] == 0, gradh[3] == 0, gradh[4] == 0],x, y, z, lam1, lam2, solution_dict=True) critical 
       
[{lam1: 1, z: -11, y: 3, x: -2, lam2: 2}, {lam1: -1, z: 3, y: -3, x:
2, lam2: 2}]