function dxyzdt = rigid_body_deriv ( t, xyz )

%*****************************************************************************80
%
%% rigid_body_deriv() evaluates the derivative of the rigid body ODE.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    30 April 2021
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Ernst Hairer,
%    Solving differential equations on manifolds,
%    Universite de Geneve,
%    June 2011.
%
%    Ernst Hairer, Christian Lubich, Gerhard Wanner,
%    Geometric numerical integration,
%    Springer, 2006.
%
%  Input:
%
%    real T, XYZ(3): the arguments of the derivative.
%
%  Output:
%
%    real DXYZDT(3): the value of the derivative.
%
  [ i1, i2, i3, t0, xyz0, tstop ] = rigid_body_parameters ( );

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

  dxdt = ( 1.0 / i3 - 1.0 / i2 ) * z * y;
  dydt = ( 1.0 / i1 - 1.0 / i3 ) * x * z;
  dzdt = ( 1.0 / i2 - 1.0 / i1 ) * y * x;

  dxyzdt = [ dxdt; dydt; dzdt ];

  return
end

