Tudat/Mathematics/BasicMathematics/sphericalHarmonics.cpp
//! Compute the gradient of a single term of a spherical harmonics potential field.
Compute the gradient of a single term of a spherical harmonics potential field.
Compute the gradient of a single term of a spherical harmonics potential field .
Eigen::Vector3d computePotentialGradient(
        const double distance,
        const double radiusPowerTerm,
        const double cosineOfOrderLongitude,
        const double sineOfOrderLongitude,
        const double cosineOfLatitude,
        const double preMultiplier,
        const int degree,
        const int order,
        const double cosineHarmonicCoefficient,
        const double sineHarmonicCoefficient,
        const double legendrePolynomial,
        const double legendrePolynomialDerivative )
{
    return ( Eigen::Vector3d( ) <<
             - preMultiplier / distance
             * radiusPowerTerm
             * ( static_cast< double >( degree ) + 1.0 ) * legendrePolynomial
             * ( cosineHarmonicCoefficient * cosineOfOrderLongitude
                 + sineHarmonicCoefficient * sineOfOrderLongitude ),
             preMultiplier * radiusPowerTerm
             * legendrePolynomialDerivative * cosineOfLatitude * (
                 cosineHarmonicCoefficient * cosineOfOrderLongitude
                 + sineHarmonicCoefficient * sineOfOrderLongitude ),
             preMultiplier * radiusPowerTerm
             * static_cast< double >( order ) * legendrePolynomial
             * ( sineHarmonicCoefficient * cosineOfOrderLongitude
                 - cosineHarmonicCoefficient * sineOfOrderLongitude ) ).finished( );
}
Eigen :: Vector3d computePotentialGradient ( const double distance , const double radiusPowerTerm , const double cosineOfOrderLongitude , const double sineOfOrderLongitude , const double cosineOfLatitude , const double preMultiplier , const int degree , const int order , const double cosineHarmonicCoefficient , const double sineHarmonicCoefficient , const double legendrePolynomial , const double legendrePolynomialDerivative ) { return ( Eigen :: Vector3d ( ) << - preMultiplier / distance * radiusPowerTerm * ( static_cast < double > ( degree ) + 1.0 ) * legendrePolynomial * ( cosineHarmonicCoefficient * cosineOfOrderLongitude + sineHarmonicCoefficient * sineOfOrderLongitude ) , preMultiplier * radiusPowerTerm * legendrePolynomialDerivative * cosineOfLatitude * ( cosineHarmonicCoefficient * cosineOfOrderLongitude + sineHarmonicCoefficient * sineOfOrderLongitude ) , preMultiplier * radiusPowerTerm * static_cast < double > ( order ) * legendrePolynomial * ( sineHarmonicCoefficient * cosineOfOrderLongitude - cosineHarmonicCoefficient * sineOfOrderLongitude ) ) . finished ( ) ; }
Compute the gradient of a single term of a spherical harmonics potential field.
Compute the gradient of a single term of a spherical harmonics potential field .
// Return result.