MATLAB Answers

Unable to find explicit solution

25 views (last 30 days)
Mohit Ray
Mohit Ray on 11 Oct 2021
Answered: Walter Roberson on 11 Oct 2021
syms x1 x2 a b c d n u1 u2 c1 c2 l1 l2 M1 M2 B P1 P2;
eqn1= P1*x2*u1*(1-l2)+(1-x2)*a*u1-2*b*(1-x2)^2*x1*n*(M1^2+u1^2)-c*u2+2*d*n*(1-x1)*(M2^2+u2^2)-c1+c2+l1<=0;
eqn2= x1*(P1*x2*u1*(1-l2)+(1-x2)*a*u1-2*b*(1-x2)^2*x1*n*(M1^2+u1^2)-c*u2+2*d*n*(1-x1)*(M2^2+u2^2)-c1+c2+l1)==0;
eqn3= P1*x1*u1-x2*a*u1+2*b*(1-x2)*x1^2*n*(M1^2+u1^2)-l2*P1*x1*u1<=0;
eqn4= x2*(P1*x1*u1-x2*a*u1+2*b*(1-x2)*x1^2*n*(M1^2+u1^2)-l2*P1*x1*u1)==0;
eqn5= -x1+1+(P2-c)*u2/(d*n*(M2^2+u2^2))<=0;
eqn6= l1*(-x1+1+(P2-c)*u2/(d*n*(M2^2+u2^2)))==0;
eqn7= P1*x2*x1*u1-B/n<=0;
eqn8= l2*(P1*x2*x1*u1-B/n);
eqn9= l1>=0;
eqn10= l2>=0;
eqn11= x1>=0;
eqn12=x2>=0;
eqn13=x1<=1;
eqn14=x2<=1;
eqns= [eqn1,eqn2,eqn3,eqn4,eqn5,eqn6,eqn7,eqn8,eqn9,eqn10,eqn11,eqn12,eqn13,eqn14];
answ = solve(eqns,[x1,x2,l1,l2],'ReturnConditions',true);
Warning: Unable to find explicit solution. For options, see help.
> In solve (line 317)
answ =
struct with fields:
x1: [0×1 sym]
x2: [0×1 sym]
l1: [0×1 sym]
l2: [0×1 sym]
parameters: [1×0 sym]
  2 Comments
Walter Roberson
Walter Roberson on 11 Oct 2021
eqn8= l2*(P1*x2*x1*u1-B/n);
Is that an implied == 0 ? You specified == 0 when appropriate for the other equations but not for this one

Sign in to comment.

Answers (2)

John D'Errico
John D'Errico on 11 Oct 2021
Edited: John D'Errico on 11 Oct 2021
Why do you think a solution exists at all? And, if a any solution does exist, then IF any solution exists at all, there will almost certainly be infinitely many solutions. And that set will very likely be a strangely curved set. And it need not be a contiguous set.
It looks like you want to solve for 4 of those variables, in terms of the other completely unknown variables as parameters. Of course, since you have no idea what values those other parameters take on, the solution will be some incredibly nasty mess. Odds are though, no analytical solution can exist at all, since the odds are good that this system of equations ends up being equivalent to some higher order polynomial, of degree higher than 4. And if that is the case, then we could provably show that no algebraic solution can exist.
And of course, the solution, all infinitely many of them, will lie on some strange looking surface in a 4 dimensional domain. To be honest, ANY surface in 4 dimensions is probably going to look strange to 3 dimensional beings who lack even 4 dimensional hyper-monitors in their brains.
So how exactly should MATLAB provide such a solution? In fact, MATLAB gave you its opinion - that it could not find a way to solve the problem.
At best, you MIGHT be able to find a few randomly scattered solutions, that will mean nothing of any value, and will provide no real information to you. You would need to provide numerical values for ALL of the other unknown parameters. Then you could TRY to use a solver, like vpasolve or fsolve, to try to find a numerical solution. And that would be effectively useless.
Just because you can write down a set of nonlinear equations does not mean you can do anything at all meaningful with them.
Ok, so, as a mathematician, how might I try to solve such a problem?
First and forremost, I would get rid of ALL of those arbitrary parameters. I would non-dimensionalize the problem. If you have ever taken a physics or engineering course, you would recognize the idea. Once you have now reduced the problem to a few ratios or products of parameters, now the problem may be simpler, at least in theory.
Then you look at what you have. There is still probably no solution, but you can now choose some valid sets of those non-dimensional parameters, and see if they represent some real world phenomena. Can you solve that problem? If not, then try to reduce the problem furthermore. At some point, you will have reduced to the problem to a simple approximation of the real world problem you want to solve, in a form that now has a solution. It will only be an approximate solution, but you will need to start there. This is not unlike an engineer assuming plane stress or plane strain applies for some more complex problem they cannot solve.

Walter Roberson
Walter Roberson on 11 Oct 2021
Generally speaking, MATLAB is weak on inequalities.
  • for a lot of inequalities, it gives up quite easily
  • most inequalities with polynomials with degree greater 3 are just given up on. Not all, but most
  • polynomials with degree 3 or greater that are not given up on, will hide all the useful information in ReturnConditions, and it can be difficult to dig anything useful out of ReturnConditions
  • The internal solver is able to find ranges of values, such as determining that a particular value has to be in the range -sqrt(3/7) to +sqrt(29/5) . However, any time such a range is returned and the range can be a resolved to fully numeric values, then the MATLAB interface to the internal solver will replace the range construct with a nominal value chosen from the range . I have posted in the past as to what values it selects. In this example, it might, for example, choose to return Pi as the nominal value, since Pi is in that range. It does not tell the user the range of values or even that there is a range: it returns a single value that satisfies the conditions
Because of this, you are often better off rewriting the equations as a series of equalities. A + B < C implies that A + B + delta == C where delta is strictly positive -- so you write in your own variables to balance the equation and assume() them as >0 or as >=0 depending on whether you want < or <= .
Your last series of equations can be replaced with assume() statements.

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by