POLYMATH Report          DEQ 
 Ordinary Differential Equations       2013-Dec-1 

Calculated values of DEQ variables
  Variable Initial value Final value Minimal value Maximal value
1 err -3.65E-07 7.75E-05 -3.65E-07 7.75E-05
2 k1 1.31164 1.8566 1.31164 1.8566
3 k2 0.532535 0.785753 0.532535 0.785753
4 Kc 5.0E+05 5.0E+05 5.0E+05 5.0E+05
5 L 100 14.0456 14.0456 100
6 T 95.5851 108.569 95.5851 108.569
7 x1 0.6 0.2 0.2 0.6
8 x2 0.4 0.8 0.4 0.8

Differential equations
1 d(T)/d(x2) = Kc*err
2 d(L)/d(x2) = L/(k2*x2-x2)

Explicit equations
1 k2 = 10^(6.95464-1344.8/(T+219.482))/(760*1.2)
2 Kc = 0.5e6
3 x1 = 1-x2
4 k1 = 10^(6.90565-1211.033/(T+220.79))/(760*1.2)
5 err = (1-k1*x1-k2*x2)

Problem source text
# S. 26(b) - DAE System
# Binary Batch Distillation
# Verified Final Values: T = 108.569, L = 14.0456
# Ref.: Comput. Appl. Eng. Educ. 6: 176, 1998
d(T)/d(x2)=Kc*err
d(L)/d(x2)=L/(k2*x2-x2)
k2=10^(6.95464-1344.8/(T+219.482))/(760*1.2)
Kc=0.5e6
x1=1-x2
k1=10^(6.90565-1211.033/(T+220.79))/(760*1.2)
err=(1-k1*x1-k2*x2)
x2(0)=0.4
T(0)=95.5851
L(0)=100
x2(f)=0.8

Matlab formatted problem
Create m file called PolyOde.m and paste the following text into it.
% Polymath ODE problem conversion to Matlab
% DEQ
function PolyOde
   tspan = [0.4 0.8]; % Range for the independent variable
   y0 = [95.5851; 100]; % Initial values for the dependent variables
   [x2,y]=ode45(@ODEfun,tspan, y0);
   plot (x2,y);
   xlabel('x2');
   legend('T','L');
   fprintf('T = %16.6f \n',y(length(y),1));
   fprintf('L = %16.6f \n',y(length(y),2));
end

function dYfuncvecdx2 = ODEfun(x2,Yfuncvec)
   T = Yfuncvec(1);
   L = Yfuncvec(2);
   k2 = 10 ^ (6.95464 - (1344.8 / (T + 219.482))) / (760 * 1.2);
   Kc = 500000;
   x1 = 1 - x2;
   k1 = 10 ^ (6.90565 - (1211.033 / (T + 220.79))) / (760 * 1.2);
   err = 1 - (k1 * x1) - (k2 * x2);
   dTdx2 = Kc * err;
   dLdx2 = L / (k2 * x2 - x2);
   dYfuncvecdx2 = [dTdx2; dLdx2];
end

General
Total number of equations 7
Number of differential equations 2
Number of explicit equations 5
Reporting digits 8
Elapsed time 1.75 sec
Solution method RKF_45
Step size guess. h 1E-06
Truncation error tolerance. eps 1E-06
Calculated Intermediate data points 50

Data file: no file

Calculated data points
    x2 T L k2 x1 k1 err
1 0.4 95.5851 100 0.532535 0.6 1.31164 -3.65E-07
2 0.416207 96.028 91.7928 0.539879 0.583909 1.32779 5.49E-05
3 0.424258 96.251 88.0339 0.543624 0.575881 1.33601 5.63E-05
4 0.432005 96.4671 84.5976 0.547286 0.568122 1.34405 5.65E-05
5 0.440003 96.6915 81.2241 0.551106 0.560126 1.35242 5.59E-05
6 0.448026 96.9181 78.0052 0.554984 0.552104 1.36092 5.72E-05
7 0.456037 97.1458 74.9461 0.558905 0.544091 1.3695 5.66E-05
8 0.464066 97.3755 72.0254 0.56288 0.536064 1.3782 5.8E-05
9 0.472092 97.6066 69.2419 0.566905 0.528037 1.387 5.73E-05
10 0.480129 97.8396 66.5821 0.570982 0.520001 1.3959 5.87E-05
11 0.488168 98.0742 64.0421 0.575114 0.511961 1.40492 5.81E-05
12 0.496216 98.3105 61.6123 0.579298 0.503915 1.41405 5.95E-05
13 0.504008 98.5409 59.3611 0.583402 0.496123 1.42299 5.99E-05
14 0.512064 98.7807 57.1324 0.587698 0.488066 1.43234 5.92E-05
15 0.520128 99.0223 54.9962 0.59205 0.480003 1.44181 6.07E-05
16 0.528195 99.2657 52.9488 0.596462 0.471934 1.45141 6.0E-05
17 0.536009 99.503 51.0463 0.600787 0.46412 1.46081 6.04E-05
18 0.54409 99.7501 49.1575 0.605316 0.456041 1.47064 6.19E-05
19 0.552175 99.9989 47.3437 0.609908 0.447955 1.4806 6.13E-05
20 0.560005 100.242 45.6554 0.614412 0.440125 1.49036 6.17E-05
21 0.568102 100.494 43.9764 0.619127 0.432029 1.50057 6.32E-05
22 0.576203 100.749 42.3613 0.62391 0.423927 1.51092 6.26E-05
23 0.58405 100.997 40.8555 0.6286 0.416081 1.52106 6.3E-05
24 0.592164 101.256 39.3555 0.633513 0.407968 1.53168 6.45E-05
25 0.600021 101.508 37.9559 0.638334 0.400111 1.54209 6.49E-05
26 0.608144 101.77 36.5607 0.643386 0.391987 1.55298 6.43E-05
27 0.616011 102.026 35.2572 0.648342 0.384119 1.56366 6.48E-05
28 0.624148 102.293 33.9562 0.653535 0.375984 1.57485 6.63E-05
29 0.632025 102.553 32.7398 0.658632 0.368107 1.58581 6.68E-05
30 0.64017 102.824 31.5249 0.663974 0.359961 1.5973 6.62E-05
31 0.648058 103.088 30.3876 0.669217 0.352072 1.60856 6.67E-05
32 0.656216 103.363 29.2503 0.674711 0.343916 1.62035 6.82E-05
33 0.664115 103.631 28.185 0.680106 0.336017 1.63192 6.87E-05
34 0.672019 103.902 27.1527 0.685577 0.328113 1.64364 6.92E-05
35 0.68019 104.183 26.1193 0.691314 0.319941 1.65592 6.87E-05
36 0.688104 104.458 25.1496 0.696946 0.312027 1.66797 6.92E-05
37 0.696023 104.735 24.2087 0.70266 0.304108 1.68018 6.97E-05
38 0.704213 105.023 23.2652 0.70865 0.29592 1.69297 7.13E-05
39 0.712142 105.305 22.379 0.714534 0.287991 1.70552 7.18E-05
40 0.720076 105.589 21.518 0.720504 0.280057 1.71824 7.24E-05
41 0.728015 105.875 20.6809 0.726563 0.272118 1.73114 7.29E-05
42 0.736222 106.173 19.8404 0.732918 0.263909 1.74467 7.24E-05
43 0.744171 106.463 19.0491 0.739161 0.255961 1.75794 7.29E-05
44 0.752125 106.756 18.2788 0.745497 0.248007 1.77139 7.35E-05
45 0.760083 107.052 17.5287 0.751929 0.240049 1.78504 7.4E-05
46 0.768046 107.35 16.7978 0.758458 0.232086 1.79888 7.46E-05
47 0.776013 107.651 16.0853 0.765087 0.224119 1.81292 7.52E-05
48 0.784253 107.964 15.3674 0.772042 0.215881 1.82763 7.69E-05
49 0.79223 108.269 14.6898 0.778878 0.207904 1.84208 7.75E-05
50 0.8 108.569 14.0456 0.785753 0.2 1.8566 7.75E-05