% 
% Compute approximate solution with a numerical scheme "METHOD"
% and compute numerically the order
%
function checkError( METHOD )
  %
  h = 0.1 ;
  N = 100 ;
  
  % compute approximate solution
  t0    = 0 ;
  y0    = [1;0] ;
  [T,Y] = feval ( METHOD, @problem1, t0, y0, h, N ) ;
  Z     = exact1( T ) ;
  E1    = max(max(abs(Y-Z))) ;

  % h <- h/2 N <- 2*N
  h = h/2 ;
  N = N*2 ;
  
  [T,Y] = feval ( METHOD, @problem1, t0, y0, h, N ) ;
  Z     = exact1( T ) ;
  E2    = max(max(abs(Y-Z))) ;
  

  % h <- h/2 N <- 2*N
  h = h/2 ;
  N = N*2 ;
  
  [T,Y] = feval ( METHOD, @problem1, t0, y0, h, N ) ;
  Z     = exact1( T ) ;
  E3    = max(max(abs(Y-Z))) ;

  fprintf( 1, 'log(E1/E2)/log(2) = %f\n', log(E1/E2)/log(2) ) ;
  fprintf( 1, 'log(E2/E3)/log(2) = %f\n', log(E2/E3)/log(2) ) ;

end