function monomial_approximate_sin ( d )

%*****************************************************************************80
%
%% monomial_approximate_sin uses monomials to approximate sin().
%
  c = monomial_approximate ( @(x)sin(x), d );

  x = linspace ( -1.0, +1.0, 101 );
  y = polyval ( c(end:-1:1), x );
  clf ( );
  hold ( 'on' );
  plot ( x, sin(x), 'g-', 'linewidth', 5  );
  plot ( x, y, 'k-', 'linewidth', 2 );
  hold ( 'off' );
  grid ( 'on' );
  xlabel ( '<-- X --->' );
  ylabel ( '<-- Y(X) --->' );
  label = sprintf ( 'Monomial approximant to sin() using degree %d', d );
  title ( label );

  filename = 'monomial_approximate_sin.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );

  return
end

