function brownian_motion_simulation_test ( )

%*****************************************************************************80
%
%% brownian_motion_simulation_test() tests the BROWNIAN_MOTION_SIMULATION library.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    04 December 2018
%
%  Author:
%
%    John Burkardt
%
  addpath ( '../brownian_motion_simulation' )

  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'brownian_motion_simulation_test():\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '  Test BROWNIAN_MOTION_SIMULATION.\n' );
%
%  Compute the path of a particle undergoing Brownian motion.
%
  for m = 1 : 3
    n = 1001;
    d = 10.0;
    t = 1.0;
    x = brownian_motion_simulation ( m, n, d, t );
    brownian_motion_display ( m, n, x );
    pause ( 5 )
  end
%
%  Estimate the average displacement of the particle from the origin
%  as a function of time.
%
  for m = 1 : 3
    k = 40;
    n = 1001;
    d = 10.0;
    t = 1.0;

    dsq = brownian_displacement_simulation ( k, n, m, d, t );
    brownian_displacement_display ( k, n, m, d, t, dsq );
    pause ( 5 )
  end
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'brownian_motion_simulation_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  fprintf ( 1, '\n' );
  timestamp ( );

  rmpath ( '../brownian_motion_simulation' )

  return
end
function timestamp ( )

%*****************************************************************************80
%
%% timestamp() prints the current YMDHMS date as a timestamp.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    14 February 2003
%
%  Author:
%
%    John Burkardt
%
  t = now;
  c = datevec ( t );
  s = datestr ( c, 0 );
  fprintf ( 1, '%s\n', s );

  return
end

