% This is the file where you store the nonlinear algebraic
% equations F1, F2 and F3.  Then you define a function called
% "ssq" that is equal to the sum of the square of the each function.
% 
% This subroutine is then called by another program called ex2.m that
% attempts to find the minimum of the function "ssq".  Since the function
% "ssq" is the "sum of squares", the function can take only positive or
% zero values.  This implies that the minimum value of the function is zero.
% This can happen only when each term, F1, F2, and F3, is equal to zero.  
% In other words, solving for the mimimum of "ssq" is the same as solving for 
% F1=0, F2=0, and F3=0.  
%


function ssq=sys_non_eq(x)
% Local parameter values
a = 1.0;
b = 2.0;
c = 3.0;
% Nonlinear algebraic functions
F1=a*x(1) + b*x(2) + c*x(3);
F2=a*x(2)*(x(1)^2)+x(3)*(x(2)^2)+x(1)*(x(3)^2)-1;
F3=b*x(1)-x(2)^3-x(3)^3-1;
ssq=F1^2+F2^2+F3^2;


%the results that I got for this set of equations are
%Y=[1.2695;1.7963;-1.6207]
