# Revision history [back]

With a little bit of playing with the code I found that the best way to solve this problem analytically is by specifying prices and income in the var() command. the code I've used is:

x, y, l, p, q, R= var('x, y, l, p, q, R') U = x^7/10 * y^3/10; U m = px+qy; m solve(m == R, y) L = U - l * (m - R); L dLdx = L.diff(x); dLdx dLdy = L.diff(y); dLdy dLdl = L.diff(l); dLdl solve([dLdx == 0, dLdy == 0, dLdl == 0], x, y, l)

With a little bit of playing with the code I found that the best way to solve this problem analytically is by specifying prices and income in the var() command. the code I've used is:

 x, y, l, p, q, R= var('x, y, l, p, q, R')
U = x^7/10 * y^3/10; U
m = px+qy; p*x+q*y; m
solve(m == R, y)
L = U - l * (m - R); L
dLdx = L.diff(x); dLdx
dLdy = L.diff(y); dLdy
dLdl = L.diff(l); dLdl
solve([dLdx == 0, dLdy == 0, dLdl == 0], x, y, l)l)

[[x == 7/10*R/p, y == 3/10*R/q, l == 22235661/100000000000*R^9/(p^7*q^3)], [x == 0, y == R/q, l == 0], [x == R/p, y == 0, l == 0]]


Where p,q and R are the prices of good x and good y and an arbitrary income level.

Very useful!