function dwxyzdt = henon_heiles_deriv ( t, wxyz )

%*****************************************************************************80
%
%% henon_heiles_deriv() evaluates the right hand side of henon_heiles_ode().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    16 September 2021
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Michel Henon, Carl Heiles,
%    The applicability of the third integral of motion: 
%    some numerical experiments,
%    Astronomical Journal,
%    Volume 69, 1964, pages 73-79.
%
%    Stephen Lucas, Evelyn Sander, Laura Taalman,
%    Modeling dynamical systems for 3D printing,
%    Notices of the American Mathematical Society,
%    Volume 67, Number 11, December 2020, pages 1692-1705.
%
%  Input:
%
%    real t: the value of the independent variable.
%
%    real wxyz: the values of the dependent variables at time T.
%
%  Output:
%
%    real dwxyzdt: the right hand side of the ODE.
%
  [ t0, wxyz0, tstop ] = henon_heiles_parameters ( );

  w = wxyz(1)
  x = wxyz(2);
  y = wxyz(3);
  z = wxyz(4);

  dwdt = - y - x^2 + y^2;
  dxdt = z;
  dydt = w;
  dzdt = - x - 2.0 * x * y;

  dwxyzdt = [ dwdt; dxdt; dydt; dzdt ];

  return
end

