"Cannot find explicit solution"

조회 수: 11 (최근 30일)
P J
P J 2015년 7월 20일
편집: Walter Roberson 2018년 7월 13일
Matlab says "Cannot find explicit solution", although I can solve it manually.
The initial equation is below:
And the explicit solution is below:
What is wrong with my code, below?
----------------------------------
>> syms x n b r a
eqn = x*(1+n)==(b/(b+1))*r*(1-a)*x^a ;
solx = solve(eqn, x)
Warning: Cannot find explicit solution.
> In solve (line 318)
solx =
Empty sym: 0-by-1
------------------------------------
  댓글 수: 2
Walter Roberson
Walter Roberson 2015년 7월 20일
Which MATLAB version are you using?
Check to see if eqns is already a logical value even before the solve() call; that happened in older MATLAB releases.
P J
P J 2015년 7월 20일
편집: Walter Roberson 2017년 7월 9일
Thank you so much for your help.
The version is R2015a (8.5.0.197613) 32 bit (win32) February 12, 2015.
When I put a more simpler equation, such as below, it worked well.
Also, I cleared all of the previous variables in the workspace, using the function "clear all."
---------------------------------------
syms x y z
eqn = x*y+x*z==z^3+y^4+15 ;
solx = solve(eqn, x)
solx =
(y^4 + z^3 + 15)/(y + z)
---------------------------------------

댓글을 달려면 로그인하십시오.

채택된 답변

Star Strider
Star Strider 2015년 7월 20일
Sometimes, you have to lead it gently by the hand:
syms x n b r a
eqn = x*(1+n)==(b/(b+1))*r*(1-a)*x^a ;
eqn = rewrite(eqn,'log');
solx = solve(eqn, x, 'IgnoreAnalyticConstraints',1)
pretty(solx)
solx =
(-((b + 1)*(n + 1))/(b*r*(a - 1)))^(1/(a - 1))
1
-----
/ (b + 1) (n + 1) \a - 1
| - --------------- |
\ b r (a - 1) /
  댓글 수: 4
Trevor Gates
Trevor Gates 2017년 7월 9일
편집: Walter Roberson 2018년 7월 13일
Hello,
I am having the same problem (i.e. unable to find explicit solution), except that in my case, there are 7 equations (with some being inequalities). Again, I am able to find an explicit solution for 'a' by hand. Is there a similar trick that I can use to help the solve() function to find it? Below is my source code. I am using the Student Version R2010a.
syms a s lambda1 lamdbda2;
obj = log(a);
cons1 = a;
cons2 = s/2 - a;
Lagrange = obj + lambda1*cons1 + lambda2*cons2;
eq1 = [char(diff(Lagrange, a)), '=0'];
eq3 = [char(diff(Lagrange, lambda1)), '>=0'];
eq4 = [char(diff(Lagrange, lambda2)), '>=0'];
eq3a = [char(diff(Lagrange, lambda1)*lambda1), '=0'];
eq4a = [char(diff(Lagrange, lambda2)*lambda2), '=0'];
eq6a = 'lambda1>=0';
eq6b = 'lambda2>=0';
[a_sol] = solve(eq1, eq3, eq4, eq3a, eq4a, eq6a, eq6b, a);
Walter Roberson
Walter Roberson 2017년 7월 9일
Trevor, your situation has to do with a MATLAB bug in the old release you are using. The workaround is to call into MuPAD directly.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Shashank kumar
Shashank kumar 2018년 7월 13일
편집: Walter Roberson 2018년 7월 13일
Hello i am also having the same problem. The above explain code is not able to solve my problem. If possible please look into it.
syms y k p b c;
eqn= k*p^(1-a)==b*p^(-a)+c;
eqn=rewrite(eqn,'log');
sol=solve(eqn, p, 'IgnoreAnalyticConstraints',1)
pretty(sol)
  댓글 수: 1
Walter Roberson
Walter Roberson 2018년 7월 13일
There is no analytic solution to that equation.

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by