function [ o, c, e ] = polynomial_axpy ( s, o1, c1, e1, o2, c2, e2 )

%*****************************************************************************80
%
%% polynomial_axpy() adds a multiple of one polynomial to another.
%
%  Discussion:
%
%    P(X) = P2(X) + S * P1(X)
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    01 January 2014
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real S, the multiplier for the first polynomial.
%
%    integer O1, the "order" of polynomial 1.
%
%    real C1(O1), the coefficients of polynomial 1.
%
%    integer E1(O1), the indices of the exponents of polynomial 1.
%
%    integer O2, the "order" of polynomial 2.
%
%    real C2(O2), the coefficients of polynomial 2.
%
%    integer E2(O2), the indices of the exponents of polynomial 2.
%
%  Output:
%
%    integer O, the "order" of the polynomial sum.
%
%    real C(O), the coefficients of the polynomial sum.
%
%    integer E(O), the indices of the exponents of the polynomial sum.
%  
  o = o1 + o2;
  c = [ s * c1, c2 ];   
  e = [ e1, e2 ];

  [ c, e ] = polynomial_sort ( o, c, e );
  [ o, c, e ] = polynomial_compress ( o, c, e );

  return
end

