"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
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.
采纳的回答
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
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
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
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!