/*******************************************************************************
*$ Component_name:
*	FKEP_SOLVEA
*$ Abstract:
*	Solves for the orbital radius at which a linear combination of omega,
*	kappa and nu equals a given value.
*$ Keywords:
*	KEPLER, ORBITAL_MOTION
*	FORTRAN, PUBLIC
*$ Declarations:
*	real*8 function	FKEP_SOLVEA( value, mOmega, mKappa, mNu )
*	real*8		value
*	integer		mOmega, mKappa, mNu
*$ Inputs:
*	value		orbital rate to match, in radians/second.
*	mOmega		integer coefficient on omega (angular frequency).
*	mKappa		integer coefficient on kappa (radial frequency).
*	mNu		integer coefficient on nu (vertical frequency).
*$ Outputs:
*	none
*$ Returns:
*	radius at which the relation comes closest to being satisfied, in km.
*$ Detailed_description:
*	This FORTRAN_callable function returns the orbital radius at which
*		value = omega * mOmega + kappa * mKappa + nu * mNu .
*	It is the inverse function of FKEP_COMBO(), and may be used to determine
*	the radius of an orbit based on its mean motion, or to solve for the
*	location of a resonance.  The planetary field must have been defined
*	previously using subroutine FKEP_SETPLANET().  Note that the accuracy of
*	the result can be controlled using FKEP_SETERROR().
*$ External_references:
*	Kep_SolveA(), fKep_Planet
*$ Examples:
*	To find the orbital radius corresponding to a particular mean motion:
*		radius = FKEP_SOLVEA(mean_motion, 1, 0, 0)
*
*	To solve for the location of an m:m-1 inner Lindblad resonance of a
*	moon at radius a_moon.  The equation to be solved is:
*		m * omega(a_moon) = m * omega(location) - kappa(location) .
*
*		omega_Moon = FKEP_OMEGA(a_moon)
*		location = FKEP_SOLVEA(m*omega_moon, m, -1, 0)
*$ Error_handling:
*	none
*$ Limitations:
*	This routine uses an iterative method to find the best solution.  It
*	returns when the fractional change is smaller than the error specified
*	by FKEP_SETERROR().
*$ Author_and_institution:
*	Mark R. Showalter
*	NASA/Ames Research Center
*$ Version_and_date:
*	1991 June 18
*$ Change_history:
*	none
*******************************************************************************/
#include "fortran.h"
#include "kepler.h"

extern KEP_PLANET fKep_Planet;

double	FORTRAN_NAME(fkep_solvea) ( value, mOmega, mKappa, mNu )
double	*value;
int	*mOmega, *mKappa, *mNu;
{
	return Kep_SolveA( &fKep_Planet, *value, *mOmega, *mKappa, *mNu );
}

/******************************************************************************/
