/*******************************************************************************
*$ Component_name:
*	Kep_Kappa
*$ Abstract:
*	Calculates the radial (eccentric) oscillation frequency as a function of
*	distance from a planet.
*$ Keywords:
*	KEPLER, ORBITAL_MOTION
*	C, PUBLIC
*$ Declarations:
*	double		Kep_Kappa( planet, a )
*	KEP_PLANET	*planet;	(typedef defined in "kepler.h")
*	double		a;
*$ Inputs:
*	planet		pointer to a KEP_PLANET structure, as returned by the
*			function Kep_SetPlanet().
*	a		mean orbital radius in km.
*$ Outputs:
*	none
*$ Returns:
*	radial oscillation frequency in radians/second.
*$ Detailed_description:
*	This function returns the frequency of radial (eccentric) oscillation
*	"kappa" of a body at the given mean distance from a planet center:
*		kappa^2 = GM/a^3 (1. - 3/2 J2 (R/a)^2 + 45/8 J4 (R/a)^4 + ...)
*	Cf. Kep_Omega(), Kep_Nu() and Kep_Combo().
*$ External_references:
*	XKep_Jseries()
*$ Examples:
*	none
*$ Error_handling:
*	none
*$ Limitations:
*	Result should be exact for infinitesimal radial perturbations to a small
*	body on a circular orbit about an oblate planet.  Perturbations from the
*	sun and any other moons and rings are not included.  A nonzero
*	eccentricity or inclination would introduce relative errors of order
*	(e^2 J2 (R/a)^2) and (sin^2(i) J2 (R/a)^2).
*$ Author_and_institution:
*	Mark R. Showalter
*	NASA/Ames Research Center
*$ Version_and_date:
*	1991 June 18
*$ Change_history:
*	none
*******************************************************************************/
#include <math.h>
#include "kepler.h"

double		Kep_Kappa( planet, a )
KEP_PLANET	*planet;
double		a;
{
double		a2, ratio2, kappa2;

	if (a == 0.) return 0.;
	if (a <  0.) a = -a;

	a2 = a * a;
	ratio2 = planet->radius2 / a2;

	kappa2 = planet->GM / (a*a2) * (1. +
		XKep_Jseries( planet->kappaJs, planet->nJs, ratio2 ));
	return sqrt(kappa2);
}

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