I've been trying to maximize and minimize the following function using Lagrange Multipliers, in Wolfram Mathematica 11.3:
d = Sqrt[x^2 + y^2 + z^2 + u^2 + v^2 + w^2]
Subject to the following constraints:
g = x + y + z + u + v + w - 1 and h = x^2 + y^2 + z^2 + u^2 + v^2 - 1
What I've tried so far is the following:
Gd = {D[d, x], D[d, y], D[d, z], D[d, u], D[d, v], D[d, w]}
Gg = {D[g, x], D[g, y], D[g, z], D[g, u], D[g, v], D[g, w]}
Gh = {D[h, x], D[h, y], D[h, z], D[h, u], D[h, v]}
system = {Gd[[1]] == \[Lambda] Gg[[1]] + \[Micro] Gh[[1]],
Gd[[2]] == \[Lambda] Gg[[2]] + \[Micro] Gh[[2]],
Gd[[3]] == \[Lambda] Gg[[3]] + \[Micro] Gh[[3]],
Gd[[4]] == \[Lambda] Gg[[4]] + \[Micro] Gh[[4]],
Gd[[5]] == \[Lambda] Gg[[5]] + \[Micro] Gh[[5]],
Gd[[6]] == \[Lambda] Gg[[6]], g == 0, h == 0};
% // MatrixForm
And then a little Solve function:
sist = Solve[system, {x, y, z, u, v, w, \[Lambda], \[Micro]}]
After executing, it just keeps running forever. Any ideas on how to make it easier?
Maximize
. It will be easier if theSqrt[]
is dropped (makes no difference to the arg max). $\endgroup$