function d = cosine_transform_inverse ( n, c )

%*****************************************************************************80
%
%% COSINE_TRANSFORM_INVERSE does an inverse cosine transform.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    26 August 2015
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Input, integer N, the number of data points.
%
%    Input, real C(N), the cosine transform coefficients.
%
%    Output, real D(N), the vector of data.
%
  d = zeros ( n, 1 );

  for i = 1 : n
    d(i) = c(1) / 2.0;
    for j = 2 : n
      d(i) = d(i) + cos ( pi * ( 2 * i - 1 ) * ( j - 1 ) / 2.0 / n ) * c(j);
    end
  end

  d(1:n) = d(1:n) * sqrt ( 2.0 / n );

  return
end
