function exercise1 ( exact )

%*****************************************************************************80
%
%% exercise1 "solves" the advection equation by displaying the exact solution.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    16 July 2020
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    value = exact ( x, t, c ): the name of a function, preceded by an @ sign,
%    which returns the exact solution of the advection equation at location
%    x, time t, and velocity c.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'exercise1:\n' );
  fprintf ( 1, '  Animate a solution to the advection equation\n' );

  c = 0.8;

  xmin = 0.0;
  xmax = 100.0;
  nx = 101;
  x = linspace ( xmin, xmax, nx );
  dx = ( xmax - xmin ) / ( nx - 1 );

  tmin = 0.0;
  tmax = 126.0;
  nt = 253;
  t = linspace ( tmin, tmax, nt );
  dt = ( tmax - tmin ) / ( nt - 1 );

  for k = 1 : nt

    u = exact ( x, t(k), c );
%
%  Plot the exact and computed solutions.
%
    plot ( x, u, 'b-', 'linewidth', 3 );
    grid ( 'on' );
    xlabel ( '<--- x --->' );
    ylabel ( '<--- u(x,t) -->' );
    label = sprintf ( 'Exact: k = %3d, t = %4.1f', k, t(k) );
    title ( label );
    axis ( [ xmin, xmax, 0.0, 1.1 ] );
    pause ( 0.1 );

  end

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

  return
end

