# Exploiting the results of an optimization

The code bellow work perfectly but if i get ride of show(), it doesn't display in LaTeX secondly I would like to display not Simply show(x1) but "x=show(x1)". How can I do that ?

(The question continue after the code)

```
%display latex
var('A, x, y, l, alpha, beta, R, p_x, p_y');
U= A*x^(alpha)*y^(beta);
show(U)
D = p_x*x + 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_l= L.diff(l)
%display latex
var('A, x, y, l, alpha, beta, R, p_x, p_y');
U= A*x^(alpha)*y^(beta);
show(U)
D = p_x*x + 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_l= 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)
l1=z[0][2].right().canonicalize_radical()
show(l1)
U1=U.subs(x=x1,y=y1).canonicalize_radical()
show(U1)
latex(U1)
```

Now yesterday some one shows me how to do the same thing with a dictionary

```
z=solve([L_x==0, L_y==0, L_l==0,], x, y, l, solution_dict=True)
show(z)
```

how can I extact $x= solution$ and so on.