# Revision history [back]

You can't : your solution involves xa2, which doesn't appear in the definition of R1 and R2 ; xa2 is an independent quantity.

May I suggest proofing your problem ?

You can't : your solution involves xa2, which doesn't appear in the definition of R1 and R2 ; xa2 is an independent quantity.

May I suggest proofing your problem ?

EDIT : After typo correction, it's clearer. And CAN be solved. Let's rewrite the problem a bit:

xa1, xa2, xb1, xb2, a, b, R1, R2 = var('xa1, xa2, xb1, xb2, a, b, R1, R2')
Ua = xa1^a * xa2^b
Ub = xb1^a*xb2^b
MUa1=Ua.diff(xa1)
MUa2=Ua.diff(xa2)
MUb1=Ub.diff(xb1)
MUb2=Ub.diff(xb2)
MRSA=MUa1/MUa2
MRSB=MUb1/MUb2
Sol=solve([MRSA==MRSB],xa1)


Let's define R1 and R2 by equations, not assignments :

E1=R1==xa1+xb1
E2=R2==xa2+xb2


sage: Sol
[xa1 == xa2*xb1/xb2]


We can solve E1 and E2 for xa1 and xa2 (thus getting tid of th,R2andxb2 :em) :

sage: solve([E1,E2],[xa1,xa2])
[xa1 == R1 - xb1, xa2 == R2 - xb2]


Let(' substitute that into your solution :

sage: Sol.subs(solve([E1,E2],[xa1,xa2]))
R1 - xb1 == (R2 - xb2)*xb1/xb2


which gives us xb1 as a function of R1, R2 and xb1 :

sage: Sol.subs(solve([E1,E2],[xa1,xa2])).solve(xb1)
[xb1 == R1*xb2/R2]
`

which if I understand you correctly,is the result you sought.

HTH,