Problems with symbolic solutions of nonlinear and linear solutions

syms x x1 x2 y y1 y2 theta p p1 p2 f f1 f2 m m1 m2 a b c d e g h ii jj k r s q w
eq_1 = x1+x2-2*x;
eq_2 = y1+y2-2*y;
eq_3 = 2*w*sin(theta)-x2+x1;
eq_4 = -y2+y1-2*w*(cos(theta)-1);
eq_5 = p1+p2-p;
eq_6 = f1+f2-f;
eq_7 = +m-m1-m2+(p1-p2)*w*cos(theta)+(f1-f2)*w*sin(theta);
eq_8 = f1-a*y1-c*theta-p1*(e*y1+h*theta);
eq_9 = f2-a*y2-c*theta-p2*(e*y2+h*theta);
eq_10 = m1-c*y1-b*theta-p1*(h*y1+g*theta);
eq_11 = m2-c*y2-b*theta-p2*(h*y2+g*theta);
eq_12 = 1/d*p1+[y1,theta]*[ii,k;k,jj]*[y1;theta]+p1*[y1,theta]*[r,q;q,s]*[y1;theta];
eq_13 = 1/d*p2+[y2,theta]*[ii,k;k,jj]*[y2;theta]+p2*[y2,theta]*[r,q;q,s]*[y2;theta];
[x,y,x1,x2,y1,y2,theta,p1,p2,f1,f2,m1,m2] = solve(eq_1,eq_2,eq_3,eq_4,eq_5,eq_6,eq_7,eq_8,eq_9,eq_10,eq_11,eq_12, eq_13,x,y,x1,x2,y1,y2,theta,p1,p2,f1,f2,m1,m2);
I tried to get the symbolic solutions by fuction 'solve' but it keeps giving me "Unable to find explicit solutions".
Just wondering if anyone can show me some tips?
Thanks in advance,
Ke

6 Commenti

Just because you want to solve a general system of nonlinear equations, does not mean an analytical solution can be shown to exist. In fact, it is essentially trivial to generate an equation that has no such solution for the roots.
If all of the many parameters in your equations have known numerical values, then you can use one of many numerical solvers. If not, then you essentially have no recourse. As I said, just wanting something is not sufficient, even if you need it very badly.
You could do some things, like eliminate some of the linear variables, solving for them in terms of the others. While this is theoretically possible, even that will surely be incredibly computationally complex. But then you will be left with a nonlinear kernel, one that will very possibly have no solution at all. After all, solve did give up. This is difficult to know, but it does suggest you need to reconsider how you are trying to solve this problem.
Thanks for your quick reply!
I had already solved a similar but more complex system of nonlinear equations, which is based the above equations, through "fsolve". I think that's what you mean by a numerical solution.
However, numerical solutions are not handy for optimization, and that's why I switched to symbolic solutions.
The above is actually from a physical model in a convincing academic article. I am just validating it, and I don't think they did all this by hand.
Things I had done for making MATLAB's life easier:
1."eliminate some of the linear variables, solving for them in terms of the others"
2. sin(theta)==theta/ cos(theta)==1 as in this case theta is around 10^-5
I had tried the above methods and MATLAB was kind of working but giving me 2 solutions for every single unknown.
Just interested in why its giving me 2 solutions..
Look forward to your reply!
Ke
Why would it not give you two solutions? :)
Much of the time when you have trig functions, there are multiple solutions. For example, even the simplest problem:
syms theta
solve(sin(theta) == 0.5)
ans =
pi/6
(5*pi)/6
has infinitely many solutions, but there are two that are of general interest, and are fundamentally different in some way. You can get the rest by adding integer multiples of 2*pi. As I said, there usually a few solutions for anything with trig functions.
Yes, fsolve (or vpasolve) is what I meant by a numerical solution.
The small angle trick is cetainly a decent approximation for such a small angle. I suppose you could use the second term from a Taylor series in there too, but that will make it nonlinear. Anyway, if your angles are that small, then dropping the higher order terms in the Taylor series will give you roughly 10 decimal places anyway. And that is roughly the default convergence tolerance for fsolve.
You might use the small angle approximation even for a symbolic solve, but there is no assurance your system of equations will be symbolically solvable. It will certainly be quite CPU intensive for a system of that size. Any solution you might find will be huge in terms of the number of terms.
Oh I was being stupid.....
I think I am nearly there!
Yes, it costs time to solve these equations.
BTW do you think if it's a good idea to switch to Maple as I heard Matlab kind of uses Maple's core?(I don't know if MATLAB community is a good place to ask Maple-related questions hahah)
Thank you so much for your help,
Ke
Honestly, I don't know the answer to your question about a direct use of Maple, if that would change anything at all. Others might, or not. Sometimes the only true way to know is a direct test, if that is possible.

Accedi per commentare.

Risposte (0)

Categorie

Prodotti

Release

R2018a

Tag

Richiesto:

il 29 Mar 2020

Commentato:

il 30 Mar 2020

Community Treasure Hunt

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

Start Hunting!

Translated by