function dxyzdt = langford_deriv ( t, xyz )

%*****************************************************************************80
%
%% langford_deriv() evaluates the right hand side of langford_ode().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    16 September 2021
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    William Langford,
%    Numerical studies of torus bifurcations,
%    Internationale Schriftenreihe zur numerischen Mathematik,
%    Volume 70, Birkhaeuser, 1984, pages 285-295.
%
%    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 xyz: the values of the dependent variables at time T.
%
%  Output:
%
%    real dxyzdt: the right hand side of the ODE.
%
  [ a, b, c, d, e, f, t0, xyz0, tstop ] = langford_parameters ( );

  x = xyz(1);
  y = xyz(2);
  z = xyz(3);

  dxdt = ( z - b ) * x - d * y;
  dydt = d * x + ( z - b ) * y;
  dzdt = c + a * z - z^3 / 3.0 - ( x^2 + y^2 ) * ( 1.0 + e * z ) + f * z * x^3;

  dxyzdt = [ dxdt; dydt; dzdt ];

  return
end

