Solution of Systems of Nonlinear Equations using Mathematical Programming

By Muhammad Al-Salamah

 

 

Suppose you want to find a solution to these nonlinear equations

If this system is going to be solved using a mathematical optimization model, the variables x1 and x2 have to be treated as decision variables. The basic idea here is that we want to find values of the decision variables that will make the right hand side of each equation equal to the left hand side. For this purpose, we can introduce new variables that will measure the deviations of the two sides.

Define the following two variables:

 

The mathematical optimization model we want to develop should minimize some positive-valued function of y1 and y2. One kind of such a function is the square function.

Now, the solution of the system of nonlinear equations is reduced to the solution of the NLP problem:

The variables y's and x's have to be specified as unrestricted.

The GAMS code to solve this problem is

variables x1,x2,y1,y2,f;
equations eq1,eq2,obj;
obj..f=e=power(y1,2)+power(y2,2);
eq1..power(x1,2)+x1*x2-10=e=y1;
eq2..x2+3*x1*power(x2,2)-57=e=y2;
model nleq /all/;
solve nleq using nlp minimizing f;
display x1.l,x2.l;