compute_laplace_coefficient Function

public pure recursive function compute_laplace_coefficient(alpha, j, s, n) result(ans)

Computes the Laplace coefficient b_s^(j)(alpha) and its derivatives using the recursive relations given in Murray & Dermott (1999), including the case where alpha is close to 1 where the G(y) series solution is used.

Arguments

Type IntentOptional Attributes Name
real(kind=DP), intent(in) :: alpha

alpha is the ratio of the inner to outer semimajor axis (a_inner/a_outer) for the coefficient being computed

integer(kind=I4B), intent(in) :: j

j is the index of the Laplace coefficient being computed.

real(kind=DP), intent(in) :: s

s is the order of the Laplace coefficient being computed.

integer(kind=I4B), intent(in) :: n

n is the order of the derivative. n=0 gives the coefficient itself, n=1 gives the first derivative, etc.

Return Value real(kind=DP)

The value of the Laplace coefficient or its derivative, depending on n.


Called by

proc~~compute_laplace_coefficient~~CalledByGraph proc~compute_laplace_coefficient compute_laplace_coefficient proc~compute_laplace_coefficient->proc~compute_laplace_coefficient proc~bindings_laplace_coefficient bindings_laplace_coefficient proc~bindings_laplace_coefficient->proc~compute_laplace_coefficient

Source Code

        pure recursive function compute_laplace_coefficient(alpha,j,s,n) result(ans)
            !! author: David A. Minton
            !! 
            !! Computes the Laplace coefficient b_s^(j)(alpha) and its derivatives using the recursive relations given in 
            !! Murray & Dermott (1999), including the case where alpha is close to 1 where the G(y) series solution is used.
            implicit none
            ! Arguments
            real(DP),     intent(in)  :: alpha
                !! alpha is the ratio of the inner to outer semimajor axis (a_inner/a_outer) for the coefficient being computed
            real(DP),     intent(in)  :: s
                !! s is the order of the Laplace coefficient being computed. 
            integer(I4B), intent(in)  :: j
                !! j is the index of the Laplace coefficient being computed.
            integer(I4B), intent(in)  :: n
                !! n is the order of the derivative. n=0 gives the coefficient itself, n=1 gives the first derivative, etc.
            real(DP)                  :: ans         
                !! The value of the Laplace coefficient or its derivative, depending on n.
            ! Internals
            real(DP) :: T1,T2,T3,T4
            
            if (n == 0) then
                ans = laplace(alpha,j,s)
                return
            else if (n==1) then
                T1 = laplace(alpha,j - 1,s + 1._DP)
                T2 = -2 * alpha * laplace(alpha,j,s + 1._DP)
                T3 = laplace(alpha, j + 1,s + 1._DP)
                ans = s * (T1 + T2 + T3)
                return
            else 
                T1 = compute_laplace_coefficient(alpha,j - 1,s + 1._DP,n - 1)
                T2 = -2 * alpha * compute_laplace_coefficient(alpha,j,s + 1._DP,n - 1)
                T3 = compute_laplace_coefficient(alpha,j + 1,s + 1._DP,n - 1)
                T4 = -2 * (n - 1) * compute_laplace_coefficient(alpha,j,s + 1._DP,n - 2)
                ans = s * (T1 + T2 + T3 + T4)
                return
            end if
        end function compute_laplace_coefficient