function y = flame_exact ( t )

%*****************************************************************************80
%
%% flame_exact() evaluates the exact solution for the flame ODE.
%
%  Discussion:
%
%    Evaluating the exact solution requires the Lambert W function.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    23 April 2021
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Cleve Moler,
%    Cleve's Corner: Stiff Differential Equations,
%    MATLAB News and Notes,
%    May 2003, pages 12-13.
%
%  Input:
%
%    real T(:): the times.
%
%  Output:
%
%    real Y(:), the exact solution values.
%
  [ t0, y0, tstop ] = flame_parameters ( );

  a = ( 1.0 - y0 ) / y0;
%
%  I have to do this stupid thing to make y a vector of the right
%  size and shape.
%
  y = t;

  for i = 1 : length ( y )
    y(i) = 1.0 ./ ( lambert_w ( a .* exp ( a - ( t(i) - t0 ) ), 0, 0 ) + 1.0 );
  end

  return
end
