Solving a homogenous non linear system of equations in MATLAB

8 views (last 30 days)
Hi all, I have the following homogeneous system. I am wondering how I can solve this in MATLAB, that is if it even has a solution. I dont mind having a solution in syms format as well. how best can I go about this? Thank you very much. Below is the system.
F (1)=-2+2*cos (x1)+cos (x4)+cos (x1)*cos (x4)+sin (x1)*sin (x4);
F (2)=-2+2*cos (x2)+cos (x5)+cos (x2)*cos (x5)+sin (x2)*sin (x5);
F (3)=-2+2*cos (x3)+cos (x6)+cos (x3)*cos (x6)+sin (x3)*sin (x6);
F (4)=-1+(-9/2+cos (x2)/2+cos (x1)+cos (x5)/2+cos (x4)).^2+(sin (x2)-sin (x1)*sin (x5)-sin (x4)).^2+(3/4)*(3-cos (x2)+cos (x5)).^2;
F (5)=-1+(1/4)*(cos (x3)-cos (x2)+cos (x6)-cos (x5)).^2+(sin (x3)-sin (x2)+sin (x6)-sin (x5)).^2+(3/4)*(-6+cos (x3)+cos (x2)+cos (x6)-cos (x5)).^2;
F (6)=-1+(-9/2+cos (x3)/2+cos (x1)+cos (x6)/2+cos (x4)).^2+(sin (x3)-sin (x1)*sin (x6)-sin (x4)).^2+(3/4)*(-3-cos (x3)+cos (x6)).^2;
where F(1)=F(2)= ... = F(6) = 0.
Any method can be used. If possible, I would like the analytic solution as well. Thanks alot

Accepted Answer

John D'Errico
John D'Errico on 15 Jul 2017
Edited: John D'Errico on 15 Jul 2017
I don't think that moving a constant term to the other side of an equality makes an equation system homogeneous. If you could do that then EVERY system of equations would be homogeneous. Be serious. Not homogeneous. :)
In fact, a homogeneous equation has a specific definition. Your equations don't fit it. Essentially, it comes down to the idea of a homogenous polynomial.
https://en.wikipedia.org/wiki/Homogeneous_polynomial
In that link, you will see that all the terms in such an expression have the same polynomial order. For example,
x + 2*y + 7*z = 0
is a linear homogeneous polynomial equation, because ALL terms have the same polynomial order (linear).
Whereas, change it slightly to one of these forms:
x + 2*y + 7*z - 2 = 0
x + 2*y + 7*z - x*y = 0
and it is NOT a homogeneous equation, even though both are equal to zero. In the latter case, there is no constant term. STILL not homogenous. I think people misunderstand what makes an equation homogeneous. It is not just the zero on the right hand side. Homogeneity requires that all terms have the same order (thus the name!) Thus a homogeneous linear system has no constant term because a constant would have a different polynomial order than linear term.
Conversely,
x^2 + x*y + 3*y^2 = 0
is homogeneous. Each term is a second degree monomial.
In your equations, you have terms of various orders. Constants, linear terms in sin(x) or cos(x), and then you have various product terms, etc.
Another way to look at homogeneity is that if the vector X is a solution to your system, then c*X is also a solution, for any constant c. In the case of a nonlinear system, I'm not sure this really makes a lot of sense, but we could talk about a system that is homogenous in sin(X).
Your system is NOT homogeneous, in any sense of the phrase.
Next, you want an analytical solution? Another LoL coming. Sorry, but you won't get one. Not only will there be probably infinitely many solutions, but there will be no analytical solution.
One way of seeing this is to substitute z1=sin(x1), etc. Of course, then cos(x1) becomes +/-sqrt(1-z1^2). Next, eliminate one variable from each equation, making the other equations considerably more complicated. By the time you get down to one equation, it is a terribly nasty mess. You would be effectively trying to solve a very high order polynomial system in the variables {z1,...,z6}. But we should all know that a general polynomial of order higher than 4 will have no analytical solution.
At best, use a solver like fsolve. It is designed to solve a nonlinear system of equations. Or, you can use vpasolve, which is still a tool that finds purely numerical solutions. You could try to use solve, but I can absolutely assure you that it will give up quickly, and then just pass it to vpasolve to try to solve.
  1 Comment
MatlabEnthusiast
MatlabEnthusiast on 15 Jul 2017
OMG, this just knocked the sense back into me. Ignoring the basics definitely won't do. thanks a lot. I am going to look into fsolve and vpasolve first thing in the morning. and let you know. But I have one more question. Using the syms command, is it not possible to get something close to a generalisation of the solutions? But thanks a lot. You cleared most of my doubts and am very grateful for that.

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!