function [ h1, h2 ] = rigid_body_conserved ( xyz )

%*****************************************************************************80
%
%% rigid_body_conserved() evaluates conserved quantities for the rigid body ODE.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    04 May 2021
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Ernst Hairer,
%    Solving differential equations on manifolds,
%    Universite de Geneve,
%    June 2011.
%
%  Input:
%
%    real XYZ(N,3): the current coordinates.
%
%  Output:
%
%    real H1(N), H2(N): the conserved quantities.
%
  [ i1, i2, i3, t0, xyz0, tstop ] = rigid_body_parameters ( );

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

  h1 = x.^2 + y.^2 + z.^2;

  h2 = x.^2 / i1 + y.^2 / i2 + z.^2 / i3;

  return
end

