"Cannot find explicit solution"

8 visualizzazioni (ultimi 30 giorni)
P J
P J il 20 Lug 2015
Modificato: Walter Roberson il 13 Lug 2018
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 Commenti
Walter Roberson
Walter Roberson il 20 Lug 2015
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 il 20 Lug 2015
Modificato: Walter Roberson il 9 Lug 2017
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)
---------------------------------------

Accedi per commentare.

Risposta accettata

Star Strider
Star Strider il 20 Lug 2015
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 Commenti
Trevor Gates
Trevor Gates il 9 Lug 2017
Modificato: Walter Roberson il 13 Lug 2018
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 il 9 Lug 2017
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.

Accedi per commentare.

Più risposte (1)

Shashank kumar
Shashank kumar il 13 Lug 2018
Modificato: Walter Roberson il 13 Lug 2018
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 Commento
Walter Roberson
Walter Roberson il 13 Lug 2018
There is no analytic solution to that equation.

Accedi per commentare.

Community Treasure Hunt

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

Start Hunting!

Translated by