POLYMATH Report          NLE 
 Nonlinear Equations 2016-May-31 

Calculated values of NLE variables
    Variable Value f(x) Initial Guess Initial f(x)
1 CD 0.705334 3.6E-13 0 -2.4E00
2 CX 0.177792 3.6E-13 0 0.0E00
3 CZ 0.373977 -2.3E-13 0 0.0E00

    Variable Value Initial Value
1 CA 0.420689 1.5
2 CA0 1.5 1.5
3 CB 0.242897 1.5
4 CB0 1.5 1.5
5 CC 0.153565 0
6 CY 0.551769 0
7 KC1 1.06 1.06
8 KC2 2.63 2.63
9 KC3 5 5

Nonlinear equations
1 f(CD) = CC*CD-KC1*CA*CB = 0
2 f(CX) = CX*CY-KC2*CB*CC = 0
3 f(CZ) = CZ-KC3*CA*CX = 0

Explicit equations
1 KC1 = 1.06
2 CY = CX+CZ
3 KC2 = 2.63
4 KC3 = 5
5 CA0 = 1.5
6 CB0 = 1.5
7 CC = CD-CY
8 CA = CA0-CD-CZ
9 CB = CB0-CD-CY

Problem source text
# S. 19 - NLE System
# Reaction Equilibrium
# Verified Solution: CD =0.705334, CX = 0.177792, CZ= 0.373977
# Infeasible Solution CD =0.055556, CX = 0.59722, CZ= 1.08207
# Infeasible Solution CD =1.0701, CX = -0.322716, CZ= 1.13053
# Ref.: Comput. Appl. Eng. Educ. 6: 174, 1998
f(CD)=CC*CD-KC1*CA*CB
f(CX)=CX*CY-KC2*CB*CC
f(CZ)=CZ-KC3*CA*CX
KC1=1.06
CY=CX+CZ
KC2=2.63
KC3=5
CA0=1.5
CB0=1.5
CC=CD-CY
CA=CA0-CD-CZ
CB=CB0-CD-CY
CD(0)=0
CX(0)=0
CZ(0)=0
#CD(0)=1
#CX(0)=1
#CZ(0)=1
#CD(0)=10
#CX(0)=10
#CZ(0)=10

Matlab formatted problem
Create m file called PolyNles.m and paste the following text into it.
% S. 19 - NLE System
% Reaction Equilibrium
% Verified Solution: CD =0.705334, CX = 0.177792, CZ= 0.373977
% Infeasible Solution CD =0.055556, CX = 0.59722, CZ= 1.08207
% Infeasible Solution CD =1.0701, CX = -0.322716, CZ= 1.13053
% Ref.: Comput. Appl. Eng. Educ. 6: 174, 1998
function PolyNles
   xguess = [0 0 0]; % initial guess vector
   x = fsolve(@MNLEfun, xguess);
   fprintf('The NLEs solution is:\n');
   fprintf('CD = %g\n',x(1));
   fprintf('CX = %g\n',x(2));
   fprintf('CZ = %g\n',x(3));
end

function fvec = MNLEfun(IndepVarsVec)
   CD = IndepVarsVec(1);
   CX = IndepVarsVec(2);
   CZ = IndepVarsVec(3);
   KC1 = 1.06;
   CY = CX + CZ;
   KC2 = 2.63;
   KC3 = 5;
   CA0 = 1.5;
   CB0 = 1.5;
   CC = CD - CY;
   CA = CA0 - CD - CZ;
   CB = CB0 - CD - CY;
   fvec(1,1) = CC * CD - (KC1 * CA * CB);
   fvec(2,1) = CX * CY - (KC2 * CB * CC);
   fvec(3,1) = CZ - (KC3 * CA * CX);
end

General Settings
Total number of equations 12
Number of implicit equations 3
Number of explicit equations 9
Elapsed time 0.01 sec
Reporting digits 8
Solution method safenewt
Max iterations 150
Tolerance F 1E-07
Tolerance X 1E-07
Tolerance min 1E-07