Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Solving Legrangians in SAGE

_Note for mods: I already submitted a question id like to update but i cant seem to find it now_

I have been running the following sage code on cocalc.com to solve a standard utility maximization problem that is in an intermediate microeconomics course. However I'm having difficulty solving these problems in the context of SAGE.

Below is the code that I have run to solve the problem and so far I believe its correct.

x,y,l=var('x,y,l')
U=x^0.7y^0.3;U
m=2
x+2y; m
solve (m==4000,y)
L=U-l
(m-4000);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)

All my code seems to be running fine, however the last line of:

solve([dLdx==0,dLdy==0,dLdl==0],x,y,l)

is not outputting the final demand equations. Is there any reason why this is happening?

Solving Legrangians in SAGE

_Note for mods: I already submitted a question id like to update but i cant seem to find it now_

I have been running the following sage code on cocalc.com to solve a standard utility maximization problem that is in an intermediate microeconomics course. However I'm having difficulty solving these problems in the context of SAGE.

Below is the code that I have run to solve the problem and so far I believe its correct.

x,y,l=var('x,y,l')
U=x^0.7y^0.3;U
m=2
x+2y; m

x,y,l=var('x,y,l')
U=x^0.7*y^0.3;U
m=2*x+2*y; m
solve (m==4000,y)
L=U-l
(m-4000);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)

(m==4000,y) L=U-l*(m-4000);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)

All my code seems to be running fine, however the last line of:

solve([dLdx==0,dLdy==0,dLdl==0],x,y,l)

solve([dLdx==0,dLdy==0,dLdl==0],x,y,l)

is not outputting the final demand equations. Is there any reason why this is happening?

Solving Legrangians in SAGE

_Note for mods: I already submitted a question id like to update but i cant seem to find it now_

I have been running the following sage code on cocalc.com to solve a standard utility maximization problem that is in an intermediate microeconomics course. However I'm having difficulty solving these problems in the context of SAGE.

Below is the code that I have run to solve the problem and so far I believe its correct.

x,y,l=var('x,y,l')
U=x^0.7*y^0.3;U
m=2*x+2*y; m
solve (m==4000,y)
L=U-l*(m-4000);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)

All my code seems to be running fine, however the last line of:

solve([dLdx==0,dLdy==0,dLdl==0],x,y,l)

is not outputting the final demand equations. Is there any reason why this is happening?

Solving Legrangians Lagrangians in SAGESage

_Note [Note for mods: I already submitted a question id I'd like to update but i cant I can't seem to find it now_ now.]

I have been running the following sage Sage code on cocalc.com to solve a standard utility maximization problem that is in an intermediate microeconomics course. However I'm having difficulty solving these problems in the context of SAGE.Sage.

Below is the code that I have run to solve the problem and so far I believe its it's correct.

x,y,l=var('x,y,l')
U=x^0.7*y^0.3;U
m=2*x+2*y; x, y, l = var('x, y, l')
U = x^0.7 * y^0.3; U
m = 2*x+2*y; m
solve (m==4000,y)
L=U-l*(m-4000);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)
solve(m == 4000, y)
L = U - l * (m - 4000); 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)

All my code seems to be running fine, however the last line of:

solve([dLdx==0,dLdy==0,dLdl==0],x,y,l)
solve([dLdx == 0, dLdy == 0, dLdl == 0], x, y, l)

is not outputting the final demand equations. Is there any reason why this is happening?

Solving Lagrangians in Sage

[Note for mods: I already submitted a question I'd like to update but I can't seem to find it now.]

I have been running the following Sage code on cocalc.com to solve a standard utility maximization problem that is in an intermediate microeconomics course. However I'm having difficulty solving these problems in the context of Sage.

Below is the code that I have run to solve the problem and so far I believe it's correct.

x, y, l = var('x, y, l')
U = x^0.7 * y^0.3; U
m = 2*x+2*y; m
solve(m == 4000, y)
L = U - l * (m - 4000); 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)

All my code seems to be running fine, however the last line of:

solve([dLdx == 0, dLdy == 0, dLdl == 0], x, y, l)

is not outputting the final demand equations. Is there any reason why this is happening?