function muller_test ( )

%*****************************************************************************80
%
%% muller_test tests muller.
%
%  generate the results on pages 135/6 of conte/deboor
%
%  Reference:
%
%    Samuel Conte, Carl de Boor,
%    Elementary Numerical Analysis,
%    Third Edition,
%    SIAM, 2017,
%    ISBN: 978-1-611975-19-2.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'muller_test:\n' );
  fprintf ( 1, '  Test muller()\n' );

  for j=1:5
   switch j
   case 0
      F = @(x) x+1;
      FNREAL = false;
      ZEROS = muller( F , FNREAL , 0, 0, 6, 1e-6, 1e-6);
      pause ( 0 )
   case 1 % J_0  Bessel function of the first kind
      disp('Example 3.13 ')
      F = @(z) besselj(0,z);
      FNREAL = false;
      ZEROS = muller( F , FNREAL , [2,4,5], 0, 40, 1e-8, 1e-8);
      pause ( 0 )
   case 2
      F = @(x) x.*(x.^2+1)-3;
      disp('Example 3.14 ')
      %FNREAL = true;
      ZEROS = muller( F , FNREAL , zeros(1,3), 0, 10, 1e-8, 1e-8);
      pause ( 0 )
   case 3
      disp('Example 3.15 ')
      F = @(x) ((((x-3.7).*x + 7.4).*x -10.8).*x+10.8).*x - 6.8;
      ZEROS = muller( F , FNREAL , zeros(1,5), 0, 20, 1e-8, 1e-8);
      pause ( 0 )
   case 4
      disp('Example 3.16 ')
      pn = struct('coefs',[1 -28 322 -1960 6769 -13132 13068 -5040], ...
                  'sites',zeros(1,8)); 
      F = @(x) horner(pn,x);
      ZEROS = muller( F , FNREAL , zeros(1,7), 0, 40, 1e-8, 1e-8);
      pause ( 0 )
   case 5
      disp('Example 3.17 ')
      pn = struct('coefs',[1 0 -170 0 7392 0 -39712 0 51200], ...
                  'sites',zeros(1,9)); 
      F = @(x) horner(pn,x);
      ZEROS = muller( F , FNREAL , zeros(1,8), 0, 40, 1e-8, 1e-8);
      pause ( 0 )
   end
   disp('               ROOT                            F(ROOT)')
   disp('       REAL        IMAGINARY           REAL          IMAGINARY')
   disp('       PART          PART              PART            PART')
   for i=1:length(ZEROS)
      Z = ZEROS(i); FZ = F(Z);
      fprintf(' %14.7e   %14.7e   %14.7e   %14.7e\n',[real(Z) imag(Z) real(FZ) imag(FZ)])
   end
end

  return
end

