function errors_test21 ( )

%*****************************************************************************80
%
%% errors_test21()
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    24 August 2017
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, '+=============================================+\n' );
  fprintf ( 1, '|                                             |\n' );
  fprintf ( 1, '|  Exercise 21                                |\n' );
  fprintf ( 1, '|                                             |\n' );
  fprintf ( 1, '|  P(X) =                                     |\n' );
  fprintf ( 1, '|       1         * x^2                       |\n' );
  fprintf ( 1, '|    -  4         * x                         |\n' );
  fprintf ( 1, '|    +  3.9999999                             |\n' );
  fprintf ( 1, '|                                             |\n' );
  fprintf ( 1, '|  Evaluate the standard quadratic formula:   |\n' );
  fprintf ( 1, '|                                             |\n' );
  fprintf ( 1, '|    X1 = 0.5 * ( -B + sqrt(B^2-4*A*C) ) / A  |\n' );
  fprintf ( 1, '|    X2 = 0.5 * ( -B - sqrt(B^2-4*A*C) ) / A  |\n' );
  fprintf ( 1, '|                                             |\n' );
  fprintf ( 1, '|  Evaluate an alternate quadratic formula:   |\n' );
  fprintf ( 1, '|                                             |\n' );
  fprintf ( 1, '|    X3 = 2 * C / ( - B + sqrt(B^2-4*A*C) )   |\n' );
  fprintf ( 1, '|    X4 = 2 * C / ( - B - sqrt(B^2-4*A*C) )   |\n' );
  fprintf ( 1, '|                                             |\n' );
  fprintf ( 1, '|  Correct results:                           |\n' );
  fprintf ( 1, '|                                             |\n' );
  fprintf ( 1, '|    1.999683772                              |\n' );
  fprintf ( 1, '|    2.000316228                              |\n' );
  fprintf ( 1, '|                                             |\n' );
  fprintf ( 1, '+=============================================+\n' );

  n = 2;
  c = [ 3.9999999, -4.0, 1.0 ];
  r1 = r8poly2_roots_standard ( c );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Standard quadratic formula:  R1 = %20.16g, R2 = %20.16g\n', r1(1), r1(2) );

  r2 = r8poly2_roots_alternate ( c );

  fprintf ( 1, '  Alternate quadratic formula: R1 = %20.16g, R2 = %20.16g\n', r2(1), r2(2) );

  return
end
