% Check the order conditions for a given method. 

% Define the method. 
s = 3;
A = [   0,    0,    0;
     5/24, 1/3, -1/24;
     1/6 , 2/3,  1/6];
b = [1/6, 2/3, 1/6];

% Comput the c vector. 
e = ones(s,1);
c = A*e

% Order conditions. 
o1 = b*e-1;
disp(sprintf('\nOrder 1, \n%g', o1))

o2 = b*c-1/2;
disp(sprintf('\nOrder 2, \n%g', o2))

o3(1) = b*c.^2-1/3;
o3(2) = b*A*c-1/6;
disp(sprintf('\nOrder 3'))
disp(sprintf('%g\n', o3))

o4(1) = b*c.^3-1/4;
o4(2) = b*(c.*(A*c))-1/8;
o4(3) = b*A*c.^2-1/12;
o4(4) = b*A*A*c-1/24;
disp(sprintf('\nOrder 4'))
disp(sprintf('%g\n', o4))

o5(1) = b*c.^4-1/5;
o5(2) = b*((c.^2).*(A*c))-1/10;
o5(3) = b*((A*c).^2)-1/20;
o5(4) = b*(c.*(A*c.^2))-1/15;
o5(5) = b*(c.*(A*A*c))-1/30;
o5(6) = b*A*c.^3-1/20;
o5(7) = b*A*(c.*(A*c))-1/40;
o5(8) = b*A*A*c.^2-1/60;
o5(9) = b*A*A*A*c-1/120;
disp(sprintf('\nOrder 5'))
disp(sprintf('%g\n', o5))




