function up = two_body_deriv ( t, u )

%*****************************************************************************80
%
%% two_body_deriv() evaluates the right hand side of two_body_ode().
%
%  Discussion:
%
%    The system describes the positions in a plane of two gravitating 
%    bodies, one much more massive than the other.
%      
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    11 November 2020
%
%  Input:
%
%    real T, the current time.
%
%    real U(4), the current state.
%
%  Output:
%
%    real UP(4), the derivative of the current state.
%
  r3 = ( u(1)^2 + u(3)^2 ) ^ 1.5;

  up = [  u(2)       ;...
         -u(1) / r3  ;...
          u(4)       ;...
         -u(3) / r3 ];

  return
end
