"Cannot find explicit solution"

118 次查看(过去 30 天)
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)

Community Treasure Hunt

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

Start Hunting!

Translated by