function u = schroedinger_nonlinear_initial ( x, t )

%*****************************************************************************80
%
%% schroedinger_nonlinear_initial() returns the initial condition.
%
%  Discussion:
%
%    The input value of T should be the initial time.
%
%  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.
%
  [ alpha, c1, c2, delta, gamma, t0, xmin, xmax ] = ...
    schroedinger_nonlinear_parameters ( );

  arg1 = i * ( ( c1 / 2.0 ) *   x           + ( alpha - ( c1 / 2.0 )^2 ) * t );
  arg3 = i * ( ( c2 / 2.0 ) * ( x - delta ) + ( alpha - ( c2 / 2.0 )^2 ) * t );

  arg2 = sqrt ( alpha ) * ( x         - c1 * t );
  arg4 = sqrt ( alpha ) * ( x - delta - c2 * t );

  u = sqrt ( alpha ) * sqrt ( 2.0 / gamma ) * ...
    ( exp ( arg1 ) .* sech ( arg2 ) + exp ( arg3 ) .* sech ( arg4 ) );

  return
end
