function [ c, z ] = roots_to_newton ( r )

%*****************************************************************************80
%
%% roots_to_newton sets a Newton polynomial from its roots.
%
%  Discussion:
%
%    This turns out to be a simple task, because of two facts:
%
%    * The divided difference polynomial of one smaller degree which
%      passes through the values ( ROOT(I), 0 ) is the zero polynomial,
%      and hence has a zero divided difference table.
%
%    * We want a polynomial of one degree higher, but we don't want it
%      to pass through an addditional point.  Instead, we specify that
%      the polynomial is MONIC.  This means that the divided difference
%      table is almost the same as for the zero polynomial, except that
%      there is one more pair of entries, an arbitrary X value, and
%      a Y value of 1.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    16 November 2019
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real r(n): the roots of the polynomial.
%
%  Output:
%
%    real c(n+1): the Newton coefficients;
%
%    real z(n+1): the Newton centers.
%
  n = length ( r );

  c = zeros ( n + 1, 1 );
  c(n+1) = 1.0;

  z = zeros ( n + 1, 1 );
  z(1:n) = r;
  z(n+1) = 0.0; 

  return
end
