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.Thu, 16 Jul 2020 22:57:04 +0200Unknown exponents causing problem to not be solvedhttps://ask.sagemath.org/question/52516/unknown-exponents-causing-problem-to-not-be-solved/Right now im trying to solve one of the problems i've encountered using sage and it seems like im onto something. However I've encountered a kink at `step3` in my code.
x1, x2, l, p1, p2, a, b, R= var('x1, x2, l, p1, p2, a, b, R')
U = x1^a*x2^b
m = p1*x1+p2*x2;
L = m+ l * (R-U);
dLdx = L.diff(x1);
dLdy = L.diff(x2);
dLdl = L.diff(l);
step1=solve([dLdx == 0, dLdy == 0, dLdl == 0], p1, p2, R)
step2=solve(step1[0][0].rhs()/step1[0][1].rhs()==p1/p2,x1)
step3=solve(U.subs(step2)==R,x2)
step3
Out: x2^b == R/(a*p2*x2/(b*p1))^a
being that I want to isolate `x2` im not sure why its power `b` is not just moved over.
why is this the case?
----------
Note: The following code works
x1, x2, l, p1, p2, a, b, Ubar= var('x1, x2, l, p1, p2, a, b, Ubar')
assume(x1>0,x2>0,a>0,b>0)
U = x1*x2
m = p1*x1+p2*x2;
L = m+ l * (Ubar-U);
dLdx = L.diff(x1);
dLdy = L.diff(x2);
dLdl = L.diff(l);
step1=solve([dLdx == 0, dLdy == 0, dLdl == 0], p1, p2, Ubar)
step2=solve(step1[0][0].rhs()/step1[0][1].rhs()==p1/p2,x1)
step3good2=solve(U.subs(step2)==Ubar,x2)
step4good1=solve(step2[0].subs(step3Good2),x1)
step3good2
Out: [x2 == sqrt(R*p1/p2)]
step4good1
Out: [x1 == sqrt(R*p1/p2)*p2/p1]
This works because I'm considering a case where our utility function has no exponents `a` and `b`. What am I missing from my code?EconJohnThu, 16 Jul 2020 22:57:04 +0200https://ask.sagemath.org/question/52516/