function u = schroedinger_linear_initial ( x, t )

%*****************************************************************************80
%
%% schroedinger_linear_initial() returns the initial condition.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    19 April 2021
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Willem Hundsdorfer, Jan Verwer,
%    Numerical solution of time-dependent advection-diffusion-reaction equations,
%    Springer, 2003
%    ISBN: 978-3-662-09017-6
%
%    http://eqworld.ipmnet.ru/
%    Exact Solutions > 
%    Nonlinear Partial Differential Equations > 
%    Second-Order Parabolic Partial Differential Equations > 
%    Schroedinger Equation with a Cubic Nonlinearity
%
%  Input:
%
%    real X(1,NX), T(NT,1): the spatial positions and time.
%
%  Output:
%
%    complex U(NT,NX): the value of the exact solution at X and T.
%
  amp = 2.0;
  mu = mean ( x );
  sigma = std ( x ) / 5.0;

  arg1 = i * x;
  arg2 = - 0.5 * ( x - mu ).^2 / sigma^2;

  u = amp * exp ( arg1 ) .* exp ( arg2 );

  return
end
