Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Optimization under constraint

Here is an incredible powerfull solution of a constrained optimization that Mathematica cannot solve without help

var('A, x, y, l, alpha, beta, R, p_x, p_y'); U= Ax^(alpha)y^(beta); show(U) D = p_xx + p_yy; show(D) show(U) solve(D==R, y) L = U-l*(D-R) show(L) L_x= L.diff(x) show(L_x) L_y= L.diff(y) show(L_y) L_lambda= L.diff(l) show(L_l) z=solve([L_x==0, L_y==0, L_l==0,], x, y, l)

Now I have two questions in one : 1) I would use greek lambda in place of l ? 2) I would retreive the values of x and y to put it in U ? I have tried some solutions as z[0 : 1 :...] but it doesnt work ? How can I do it ?

Optimization under constraint

Here is an incredible powerfull solution of a constrained optimization that Mathematica cannot solve without help

var('A, x, y, l, alpha, beta, R, p_x, p_y');
U= Ax^(alpha)y^(beta);
A*x^(alpha)*y^(beta);
show(U)
D = p_xx p_x*x + p_yy;
p_y*y;
show(D)
show(U)
solve(D==R, y)
L = U-l*(D-R)
show(L)
L_x= L.diff(x)
show(L_x)
L_y= L.diff(y)
show(L_y)
L_lambda= L.diff(l)
show(L_l)
z=solve([L_x==0, L_y==0, L_l==0,], x, y, l)

l)

Now I have two questions in one : 1) :

  1. I would use greek lambda in place of l ? 2) ?

  2. I would retreive the values of x and y to put it in U ? I have tried some solutions as z[0 : 1 :...] but it doesnt work ? How can I do it ?