POLYMATH Report          DEQ 
 Ordinary Differential Equations       2016-May-31 

Calculated values of DEQ variables
  Variable Initial value Final value Minimal value Maximal value
1 CA 0.2 0.140461 0.140442 0.2
2 CA1 0.2 0.140446 0.140428 0.2
3 CAanal 0.2 0.138273 0.138273 0.2
4 DAB 1.2E-09 1.2E-09 1.2E-09 1.2E-09
5 delta 0.0001 0.0001 0.0001 0.0001
6 derr 1 1.44642 1 1.44642
7 err -130 2.76438 -130 2.76438
8 err1 -130.013 2.74558 -130.013 2.74558
9 k 0.001 0.001 0.001 0.001
10 L 0.001 0.001 0.001 0.001
11 y -130 2.76438 -130 2.76438
12 y0 -130 -130 -130 -130
13 y1 -130.013 2.74558 -130.013 2.74558
14 ynew -5.23E-11 -131.911 -131.911 -5.23E-11
15 z 0 0.001 0 0.001

Differential equations
1 d(CA)/d(z) = y
2 d(y)/d(z) = k*CA/DAB
3 d(CA1)/d(z) = y1
4 d(y1)/d(z) = k*CA1/DAB

Explicit equations
1 k = 0.001
2 DAB = 1.2E-9
3 err = y-0
4 err1 = y1-0
5 y0 = -130
6 L = .001
7 delta = 0.0001
8 CAanal = 0.2*cosh(L*(k/DAB)^.5*(1-z/L))/(cosh(L*(k/DAB)^.5))
9 derr = (err1-err)/(delta*y0)
10 ynew = y0-err/derr

Problem source text
# S. 25* - Boundary Value ODE System
# Diffusion with Reaction
# Verified Final Values: CA = 0.140461, y = 2.76438
# Ref.: Comput. Appl. Eng. Educ. 6: 175-176, 1998
d(CA)/d(z)=y
d(y)/d(z)=k*CA/DAB
d(CA1)/d(z)=y1
d(y1)/d(z)=k*CA1/DAB
k=0.001
DAB=1.2E-9
err=y-0
err1=y1-0
y0=-130
L=.001
delta=0.0001
CAanal=0.2*cosh(L*(k/DAB)^.5*(1-z/L))/(cosh(L*(k/DAB)^.5))
derr=(err1-err)/(delta*y0)
ynew=y0-err/derr
z(0)=0
CA(0)=0.2
y(0)=-130
CA1(0)=0.2
y1(0)=-130.013
z(f)=0.001

Matlab formatted problem
Create m file called PolyOde.m and paste the following text into it.
% S. 25* - Boundary Value ODE System
% Diffusion with Reaction
% Verified Final Values: CA = 0.140461, y = 2.76438
% Ref.: Comput. Appl. Eng. Educ. 6: 175-176, 1998
function PolyOde
   tspan = [0 0.001]; % Range for the independent variable
   y0 = [0.2; -130; 0.2; -130.013]; % Initial values for the dependent variables
   [z,y]=ode45(@ODEfun,tspan, y0);
   plot (z,y);
   xlabel('z');
   legend('CA','y','CA1','y1');
   fprintf('CA = %16.6f \n',y(length(y),1));
   fprintf('y = %16.6f \n',y(length(y),2));
   fprintf('CA1 = %16.6f \n',y(length(y),3));
   fprintf('y1 = %16.6f \n',y(length(y),4));
end

function dYfuncvecdz = ODEfun(z,Yfuncvec)
   CA = Yfuncvec(1);
   y = Yfuncvec(2);
   CA1 = Yfuncvec(3);
   y1 = Yfuncvec(4);
   k = 0.001;
   DAB = 1.2E-09;
   err = y - 0;
   err1 = y1 - 0;
   y0 = -130;
   L = 0.001;
   delta = 0.0001;
   CAanal = 0.2 * cosh(L * (k / DAB) ^ 0.5 * (1 - (z / L))) / cosh(L * (k / DAB) ^ 0.5);
   derr = (err1 - err) / (delta * y0);
   ynew = y0 - (err / derr);
   dCAdz = y;
   dydz = k * CA / DAB;
   dCA1dz = y1;
   dy1dz = k * CA1 / DAB;
   dYfuncvecdz = [dCAdz; dydz; dCA1dz; dy1dz];
end

General Settings
Total number of equations 14
Number of differential equations 4
Number of explicit equations 10
Reporting digits 8
Elapsed time 0.11 sec
Solution method RKF_45
Step size guess. h 1E-06
Truncation error tolerance. eps 1E-06
Calculated Intermediate data points 50

Calculated data points
    z CA y CA1 y1 err err1 CAanal derr ynew
1 0 0.2 -130 0.2 -130.013 -130 -130.013 0.2 1 -5.23E-11
2 4.9E-05 0.193828 -121.961 0.193827 -121.974 -123.256 -123.269 0.19473 1.0007 -6.83011
3 6.5E-05 0.191897 -119.389 0.191896 -119.402 -120.672 -120.685 0.192748 1.00135 -9.4914
4 8.1E-05 0.190007 -116.843 0.190006 -116.856 -118.113 -118.126 0.190808 1.00222 -12.1487
5 0.000113 0.186349 -111.826 0.186347 -111.839 -113.071 -113.084 0.187048 1.0046 -17.4466
6 0.000129 0.18458 -109.353 0.184578 -109.366 -110.586 -110.599 0.185228 1.00611 -20.085
7 0.000145 0.18285 -106.903 0.182848 -106.916 -108.125 -108.138 0.183447 1.00783 -22.715
8 0.000161 0.181159 -104.477 0.181156 -104.49 -105.687 -105.7 0.181706 1.00977 -25.3354
9 0.000193 0.177892 -99.6895 0.17789 -99.7027 -100.878 -100.891 0.178339 1.01429 -30.5435
10 0.000209 0.176316 -97.3282 0.176313 -97.3414 -98.5063 -98.5195 0.176713 1.01688 -33.129
11 0.000225 0.174778 -94.9876 0.174775 -95.0009 -96.1554 -96.1686 0.175125 1.01968 -35.7009
12 0.000241 0.173276 -92.6673 0.173273 -92.6806 -93.825 -93.8383 0.173574 1.02271 -38.2581
13 0.000273 0.170384 -88.0855 0.170381 -88.0989 -89.2238 -89.2371 0.170582 1.0294 -43.3248
14 0.000289 0.168993 -85.823 0.168989 -85.8365 -86.952 -86.9654 0.169141 1.03308 -45.8324
15 0.000305 0.167638 -83.5788 0.167634 -83.5923 -84.6987 -84.7122 0.167737 1.03698 -48.3217
16 0.000321 0.166319 -81.3525 0.166314 -81.3661 -82.4635 -82.477 0.166367 1.0411 -50.7919
17 0.000353 0.163786 -76.9514 0.163781 -76.9651 -78.0454 -78.0591 0.163736 1.05 -55.6714
18 0.000369 0.162572 -74.7757 0.162567 -74.7895 -75.8616 -75.8753 0.162472 1.05479 -58.0792
19 0.000385 0.161393 -72.616 0.161388 -72.6298 -73.6939 -73.7077 0.161243 1.05981 -60.4648
20 0.000401 0.160248 -70.4718 0.160243 -70.4856 -71.542 -71.5559 0.160049 1.06505 -62.8274
21 0.000433 0.158061 -66.2279 0.158056 -66.242 -67.2835 -67.2975 0.157763 1.07621 -67.481
22 0.000449 0.157018 -64.1274 0.157012 -64.1416 -65.176 -65.1901 0.15667 1.08213 -69.7709
23 0.000465 0.156009 -62.0406 0.156003 -62.0548 -63.0824 -63.0965 0.155611 1.08829 -72.0353
24 0.000481 0.155033 -59.9671 0.155027 -59.9813 -61.0022 -61.0165 0.154585 1.09468 -74.2738
25 0.000513 0.15318 -55.8578 0.153173 -55.8723 -56.8806 -56.895 0.152631 1.10816 -78.671
26 0.000529 0.152303 -53.8213 0.152295 -53.8359 -54.8381 -54.8526 0.151704 1.11525 -80.8288
27 0.000545 0.151458 -51.7963 0.15145 -51.8109 -52.8074 -52.822 0.150808 1.12258 -82.9588
28 0.000561 0.150645 -49.7823 0.150637 -49.7971 -50.788 -50.8027 0.149945 1.13015 -85.0608
29 0.000593 0.149116 -45.7858 0.149108 -45.8007 -46.7811 -46.796 0.148314 1.14601 -89.1793
30 0.000609 0.148399 -43.8024 0.148391 -43.8174 -44.7929 -44.8079 0.147547 1.15431 -91.1952
31 0.000625 0.147714 -41.8283 0.147706 -41.8435 -42.8142 -42.8294 0.14681 1.16286 -93.1819
32 0.000641 0.147061 -39.8632 0.147052 -39.8785 -40.8447 -40.8599 0.146105 1.17165 -95.1392
33 0.000673 0.145848 -35.958 0.145838 -35.9735 -36.9313 -36.9468 0.144789 1.18999 -98.965
34 0.000689 0.145288 -34.0171 0.145278 -34.0328 -34.9867 -35.0023 0.144177 1.19954 -100.833
35 0.000705 0.144759 -32.0835 0.144749 -32.0993 -33.0495 -33.0652 0.143596 1.20934 -102.672
36 0.000721 0.144261 -30.1568 0.144251 -30.1727 -31.1193 -31.1352 0.143045 1.2194 -104.48
37 0.000753 0.143358 -26.3221 0.143347 -26.3383 -27.2786 -27.2947 0.142036 1.24031 -108.007
38 0.000769 0.142952 -24.4134 0.142941 -24.4298 -25.3671 -25.3834 0.141577 1.25116 -109.725
39 0.000785 0.142576 -22.5099 0.142565 -22.5264 -23.4611 -23.4775 0.141148 1.26228 -111.414
40 0.000801 0.142231 -20.6112 0.14222 -20.6279 -21.56 -21.5766 0.140749 1.27366 -113.072
41 0.000833 0.141632 -16.8267 0.141621 -16.8436 -17.7714 -17.7882 0.140041 1.29725 -116.301
42 0.000849 0.141378 -14.94 0.141366 -14.9571 -15.8829 -15.8999 0.139732 1.30946 -117.871
43 0.000865 0.141154 -13.0564 0.141142 -13.0737 -13.9979 -14.015 0.139452 1.32195 -119.411
44 0.000881 0.140961 -11.1757 0.140948 -11.1931 -12.1158 -12.1331 0.139203 1.33472 -120.923
45 0.000913 0.140663 -7.42099 0.14065 -7.43878 -8.35898 -8.37667 0.138793 1.36112 -123.859
46 0.000929 0.140559 -5.54621 0.140546 -5.56417 -6.48346 -6.50133 0.138632 1.37475 -125.284
47 0.000945 0.140486 -3.67261 0.140472 -3.69076 -4.60931 -4.62737 0.138501 1.38868 -126.681
48 0.000961 0.140442 -1.7998 0.140428 -1.81813 -2.73616 -2.7544 0.1384 1.4029 -128.05
49 0.000993 0.140444 1.94508 0.140429 1.92636 1.00881 0.990186 0.138286 1.43224 -130.704
50 0.001 0.140461 2.76438 0.140446 2.74558 2.76438 2.74558 0.138273 1.44642 -131.911