Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Sorry I have no time to adapt the solution exactly to your context but to go short you can remove alpha and beta from the variables and replace it by your values. Or you can also explicitely define U( x, y, l, alpha, beta) =... and specify in L U(....).

You should try this

%display latex

var('A, x, y, l, alpha, beta, R, p_x, p_y');
U= A*x^(alpha)*y^(beta);
D = p_x*x + p_y*y;
show(U)
show(D)
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_l= L.diff(l)
show(L_l)
z=solve([L_x==0, L_y==0, L_l==0,], x, y, l,  solution_dict=True)
z[0]