Solve not working: Cannot find explicit solution
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Deokjae Jeong
il 20 Nov 2016
Commentato: Karan Gill
il 23 Nov 2016
I cannot proceed anymore after I got the result below.
x1 =
(w1/(A*a*p*x2^b))^(1/(a - 1))
x2 =
(w2/(A*b*p*x1^a))^(1/(b - 1))
========================================================================
These two equations above both includes x1 and x2, and I need to get an explicit function of x1 and x2 as the following:


========================================================================
The following is my original code that I used:
clc
clear
syms A x1 x2 w1 w2 a b p ;
assume(A>0 & a+b<1 & a>0 & b>0);
f=A*x1^a*x2^b ;
l=p*f-w1*x1-w2*x2;
eqn1=diff(l,x1)==0;
eqn2=diff(l,x2)==0;
x1 = solve(eqn1, x1,'IgnoreAnalyticConstraints',1)
x2 = solve(eqn2, x2,'IgnoreAnalyticConstraints',1)
========================================================================
I have tried many ways as below, but none of these worked.
Do you know why these do not work, and could you solve this problem?
%%%%TRY1
x1=subs(x1)
x1 = solve(eqn1, x1,'IgnoreAnalyticConstraints',1)
%%%%TRY2
eqn21= x1 == solve(eqn1, x1,'IgnoreAnalyticConstraints',1)
eqn22= x2 == solve(eqn2, x2,'IgnoreAnalyticConstraints',1)
sol = solve([eqn21, eqn22], [x1, x2],'IgnoreAnalyticConstraints',1)
%%%%TRY3
eqn1 = rewrite(eqn1,'log');
eqn2 = rewrite(eqn2,'log');
0 Commenti
Risposta accettata
Roger Stafford
il 21 Nov 2016
What you have are two simultaneous equations in two unknowns. The function ‘solve’ must receive both of the equations together in order to solve for the two unknowns, and only in “TRY2” did you try that. I am not sure why that one didn’t work, but you should use it in this manner with the original ‘eqn1’ and ‘eqn2’.
However, you don’t really need ‘solve’ at all in this problem. It can be solved with some very simple algebraic manipulations:
Rewrite diff(l,x1)==0 as x2^b/x1^(1-a) = w1/(p*A*a)
and diff(l,x2)==0 as x1^a/x2^(1-b) = w2/(p*A*b)
Dividing the first of these by the second gives:
x2/x1 = w1/w2*b/a
or
x2 = w1/w2*b/a*x1
Making this substitution for x2 in the equations above yields the solution to the problem:
x1 = ((p*A*b^b*a^(1-b))/(w2^b*w1^(1-b)))^(1/(1-a-b));
x2 = ((p*A*a^a*b^(1-a))/(w1^a*w2^(1-a)))^(1/(1-a-b));
3 Commenti
Roger Stafford
il 22 Nov 2016
I tried to use ‘solve’ to get the solution to your two equations on my rather ancient version of ‘solve’ and also failed. You should realize that there is nothing unusual about failures of ‘solve’ in finding solutions. Perhaps you may remember in your course in integral calculus that the number of integrals you could successfully find explicit solutions for were greatly outnumbered by those for which you couldn’t. The situation for ‘solve’ is similar to that. It doesn’t take a very complicated equation or equations to baffle it. Ordinarily these are cases where a human would also be unable to find a solution. Your particular problem is a little unusual in that humans can easily find the solution but ‘solve’ apparently can’t. However, you might try adding the assumptions using ‘assume’ that your variables are all real and positive and that 1-a>0 and 1-b>0. But remember what I said earlier: you have to present both equations to ‘solve’ at the same time, and if ‘solve’ succeeds, it will yield both unknowns x1 and x2 together (as in your “TRY2”.)
Karan Gill
il 23 Nov 2016
My guess is it has to do with finding the right assumptions. For example, in Roger's manipulation above, to divide by "A","a","p" etc one must assume that they are not equal to 0.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Linear Algebra in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!