ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 15 Jul 2020 18:50:13 +0200Obtaining analytical solutions to utility maximization problemshttps://ask.sagemath.org/question/52475/obtaining-analytical-solutions-to-utility-maximization-problems/A while back I posted asking about <a href="https://ask.sagemath.org/question/51241/solving-lagrangians-in-sage/">Solving Lagrangians in Sage</a>. The numeric solutions I found to be extremely useful for understanding where exactly a maximum/ minimum lies. This is given by the following code:
x, y, l = var('x, y, l')
U = x^7/10 * y^3/10; 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)
Im wondering however if there is a way to get an analytical solution? In the context of a utility maximization problem it would be a set of demand equations as a function of prices and Income. On paper we can do this easily in this context however it seems pretty difficult for me to understand.
Wed, 15 Jul 2020 18:03:41 +0200https://ask.sagemath.org/question/52475/obtaining-analytical-solutions-to-utility-maximization-problems/Answer by EconJohn for <p>A while back I posted asking about <a href="https://ask.sagemath.org/question/51241/solving-lagrangians-in-sage/">Solving Lagrangians in Sage</a>. The numeric solutions I found to be extremely useful for understanding where exactly a maximum/ minimum lies. This is given by the following code:</p>
<pre><code>x, y, l = var('x, y, l')
U = x^7/10 * y^3/10; 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)
</code></pre>
<p>Im wondering however if there is a way to get an analytical solution? In the context of a utility maximization problem it would be a set of demand equations as a function of prices and Income. On paper we can do this easily in this context however it seems pretty difficult for me to understand. </p>
https://ask.sagemath.org/question/52475/obtaining-analytical-solutions-to-utility-maximization-problems/?answer=52477#post-id-52477With 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 = 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)
[[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!Wed, 15 Jul 2020 18:50:13 +0200https://ask.sagemath.org/question/52475/obtaining-analytical-solutions-to-utility-maximization-problems/?answer=52477#post-id-52477