function value = kepler ( x )
%*****************************************************************************80
%
%% kepler evaluates a version of Kepler's equation.
%
% Discussion:
%
% Kepler's equation relates the mean anomaly M, the eccentric anomaly E,
% andthe eccentricity e of a planetary orbit.
%
% Typically, e is a fixed feature of the orbit, the value of M is determined
% by observation, and the value of E is desired.
%
% Kepler's equation states that:
% M = E - e sin(E)
%
% Suppose we have an orbit with e = 2, and we have observed M = 5. What is
% the value of E? The equation becomes:
% 5 = E - 2 sin ( E ).
%
% To solve for E, we need to rewrite this as a function:
% F(E) = 5 - E + 2 sin ( E )
% and then use a nonlinear equation solver to solve for the value of E
% such that F(E)=0.
%
% Licensing:
%
% This code is distributed under the GNU LGPL license.
%
% Modified:
%
% 25 July 2019
%
% Input:
%
% real x, the current estimate for the value of E.
%
% Output:
%
% real value, the Kepler equation residual F(E).
%
value = 5.0 - x + 2.0 * sin ( x );
return
end