function r8poly_power_test ( )

%*****************************************************************************80
%
%% r8poly_power_test() tests r8poly_power().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    21 October 2019
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'r8poly_power_test():\n' );
  fprintf ( 1, '  r8poly_power() takes a polynomial to a power.\n' );
%
%  Cube (2-X).  Answer is 8-12*X+6*X^2-X^3.
%
  na = 1;
  a(1:na+1) = [ 2.0, -1.0 ];
  p = 3;
  r8poly_print ( a, '  The polynomial A:' );
 
  b = r8poly_power ( na, a, p );
  r8poly_print ( b, '  Raised to the power 3:' );

  c = [ 8.0, -12.0, 6.0, -1.0 ];
  r8poly_print ( c, '  Correct result:' );
%
%  Square X+X^2
%
  na = 2;
  a(1:na+1) = [ 0.0, 1.0, 1.0 ];
  p = 2;
  r8poly_print ( a, '  The polynomial A:' );
 
  b = r8poly_power ( na, a, p );
  r8poly_print ( b, '  Raised to the power 2:' );

  c = [ 0.0, 0.0, 1.0, 2.0, 1.0 ];
  r8poly_print ( c, '  Correct result:' );

  return
end
