Langrage Multipliers, Ending up with huge values

1 view (last 30 days)
I was trying to use langrage multipliers to solve for the minimum and maximum of the following functions; however, upon using the following commands, I end up with enormous values for the critical points, which I don't think are correct. Please help!:
syms x;
syms y;
syms w;
syms z;
f=5.0*y - 1.0*w*x - 9.0*w*y + 5.0*w*z + 10.0*x*y + x^2
g=0.06964*w*x + 0.1368*w*z + 0.1525*x*y + 0.114*x*z + 0.247*y*z + 0.3672*w^2 + 0.3393*x^2 + 0.4146*y^2 + 0.1505*z^2
Dfw=diff(f,w)
Dfx=diff(f,x)
Dfy=diff(f,y)
Dfz=diff(f,z)
Dgw=diff(g,w)
Dgx=diff(g,x)
Dgy=diff(g,y)
Dgz=diff(g,z)
syms L
assume(L, 'real')
[LSols2, wSols2, xSols2, ySols2, zSols2]=solve([Dfw==L*Dgw, Dfx==L*Dgx, Dfy==L*Dgy, Dfz==L*Dgz, g==1], [L,w,x,y,z])
-And then the values for LSols2, wSols2, xSols2, ySols2, zSols2 are all, gigantic.
  1 Comment
the cyclist
the cyclist on 14 Nov 2019
It's vastly better to post code, rather than images of code. That way people can copy & paste your code for testing.

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!