POLYMATH Report          DEQ 
 Ordinary Differential Equations       2016-May-30 

Calculated values of DEQ variables
  Variable Initial value Final value Minimal value Maximal value
1 A 1 0.049787 0.049787 1
2 B 0 0.047308 0 0.249947
3 C 0 0.902905 0 0.902905
4 k1 1 1 1 1
5 k2 2 2 2 2
6 t 0 3 0 3

Differential equations
1 d(A)/d(t) = -k1*A
2 d(B)/d(t) = k1*A - k2*B
3 d(C)/d(t) = k2*B

Explicit equations
1 k1 = 1
2 k2 = 2

Problem source text
# S. 10 - ODE System
# Simple set of consecutive reactions
# Verified Final Values: A = 0.049787, B = 0.047308 , C= 0.902905
d(A)/d(t) = -k1*A
d(B)/d(t) = k1*A - k2*B
d(C)/d(t) = k2*B
k1 = 1
k2 = 2
A(0) = 1
B(0) = 0
C(0) = 0
t(0) = 0
t(f) = 3

Matlab formatted problem
Create m file called PolyOde.m and paste the following text into it.
% S. 10 - ODE System
% Simple set of consecutive reactions
% Verified Final Values: A = 0.049787, B = 0.047308 , C= 0.902905
function PolyOde
   tspan = [0 3]; % Range for the independent variable
   y0 = [1; 0; 0]; % Initial values for the dependent variables
   [t,y]=ode45(@ODEfun,tspan, y0);
   plot (t,y);
   xlabel('t');
   legend('A','B','C');
   fprintf('A = %16.6f \n',y(length(y),1));
   fprintf('B = %16.6f \n',y(length(y),2));
   fprintf('C = %16.6f \n',y(length(y),3));
end

function dYfuncvecdt = ODEfun(t,Yfuncvec)
   A = Yfuncvec(1);
   B = Yfuncvec(2);
   C = Yfuncvec(3);
   k1 = 1;
   k2 = 2;
   dAdt = 0 - (k1 * A);
   dBdt = k1 * A - (k2 * B);
   dCdt = k2 * B;
   dYfuncvecdt = [dAdt; dBdt; dCdt];
end

General Settings
Total number of equations 5
Number of differential equations 3
Number of explicit equations 2
Reporting digits 8
Elapsed time 0.06 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
    t A B C
1 0 1 0 0
2 0.127261 0.880504 0.105217 0.014279
3 0.189014 0.827775 0.142563 0.029661
4 0.261576 0.769837 0.177188 0.052975
5 0.30189 0.73942 0.192678 0.067902
6 0.390659 0.676611 0.218809 0.104581
7 0.438659 0.644901 0.229004 0.126096
8 0.486659 0.614677 0.236849 0.148474
9 0.582659 0.558412 0.246588 0.195
10 0.630659 0.532241 0.248961 0.218799
11 0.678659 0.507297 0.249947 0.242756
12 0.726659 0.483522 0.249728 0.26675
13 0.822659 0.439262 0.246311 0.314427
14 0.870659 0.418676 0.243386 0.337938
15 0.918659 0.399054 0.23981 0.361136
16 0.966659 0.380352 0.235684 0.383964
17 1.06266 0.345536 0.226141 0.428323
18 1.11066 0.329342 0.220876 0.449782
19 1.15866 0.313907 0.215369 0.470724
20 1.20666 0.299195 0.209677 0.491127
21 1.30266 0.271808 0.197928 0.530263
22 1.35066 0.259069 0.191952 0.548978
23 1.39866 0.246928 0.185955 0.567118
24 1.44666 0.235355 0.179963 0.584681
25 1.54266 0.213812 0.168096 0.618092
26 1.59066 0.203791 0.16226 0.633948
27 1.63866 0.19424 0.156511 0.649249
28 1.68666 0.185137 0.150861 0.664002
29 1.78266 0.16819 0.139902 0.691907
30 1.83066 0.160308 0.134609 0.705083
31 1.87866 0.152795 0.129449 0.717757
32 1.92666 0.145634 0.124425 0.729941
33 2.02266 0.132303 0.114799 0.752898
34 2.07066 0.126103 0.110201 0.763697
35 2.11866 0.120193 0.105746 0.774061
36 2.16666 0.11456 0.101436 0.784004
37 2.26266 0.104073 0.093242 0.802684
38 2.31066 0.099196 0.089356 0.811448
39 2.35866 0.094547 0.085608 0.819845
40 2.40666 0.090116 0.081995 0.827889
41 2.50266 0.081867 0.075165 0.842968
42 2.55066 0.07803 0.071942 0.850028
43 2.59866 0.074373 0.068842 0.856785
44 2.64666 0.070888 0.065863 0.86325
45 2.74266 0.064399 0.060252 0.875349
46 2.79066 0.061381 0.057613 0.881006
47 2.83866 0.058504 0.055081 0.886415
48 2.88666 0.055762 0.052653 0.891585
49 2.98266 0.050658 0.048092 0.90125
50 3 0.049787 0.047308 0.902905