# Revision history [back]

### 3 questions in one about exploiting the result of an optimization

This is an incredible result of SageMath since one is obliged to help Mathematica to obtain the result

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) show(z[0]) x1=z[0][0].right() show(x1) y1=z[0][1].right() show(y1) U1=U.subs(x=x1,y=y1) show(U1)

But I would ameliorate the presentation :

1) How can I substitute greek $\lambda$ to l in the code ?

2) The final result should be simplified because there are possible factorizations ?

3) How can I, without rewriting, all the code add the hypothesis $\alpha+ \beta =1$ ?

4) how to have the results automaticaly written in LaTeX without using show()

A great hand shake for the one who will help me on those maters.

 2 None tmonteil 25328 ●29 ●180 ●472 http://wiki.sagemath.o...

### 3 questions in one about exploiting the result of an optimization

This is an incredible result of SageMath since one is obliged to help Mathematica to obtain the result

 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)
show(z[0])
x1=z[0][0].right()
show(x1)
y1=z[0][1].right()
show(y1)
U1=U.subs(x=x1,y=y1)
show(U1)show(U1)


But I would ameliorate the presentation :

1) How can I substitute greek $\lambda$ to l in the code ?

2) The final result should be simplified because there are possible factorizations ?

3) How can I, without rewriting, all the code add the hypothesis $\alpha+ \beta =1$ ?

4) how to have the results automaticaly written in LaTeX without using show()

A great hand shake for the one who will help me on those maters.