function c2 = newton_to_power ( c1, z1 )

%*****************************************************************************80
%
%% newton_to_power converts a polynomial from Newton to power form.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    14 November 2019
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Carl deBoor,
%    A Practical Guide to Splines,
%    Springer, 2001,
%    ISBN: 0387953663,
%    LC: QA1.A647.v27.
%
%  Input:
%
%    real c1(n): the Newton coefficients.
%
%    real z1(n): the Newton centers.
%
%  Output:
%
%    real c2(n): the power form coefficients.
%
  n = length ( c1 );

  c2(1:n) = c1(1:n);
  for j = 1 : n - 1
    for i = n - 1 : -1 : j
      c2(i) = c2(i) - z1(i-j+1) * c2(i+1);
    end
  end

  return
end
