GetLegendreRecurrenceCoeff
Recurrence coefficients are for monic and nonmonic Legendre polynomials.
Interface 1
Monic polynomials
INTERFACE
  MODULE PURE SUBROUTINE GetLegendreRecurrenceCoeff(n, alphaCoeff, betaCoeff)
    INTEGER(I4B), INTENT(IN) :: n
    !! order of Legendre polynomial, it should be greater than 1
    REAL(DFP), INTENT(OUT) :: alphaCoeff(0:n - 1)
    REAL(DFP), INTENT(OUT) :: betaCoeff(0:n - 1)
  END SUBROUTINE GetLegendreRecurrenceCoeff
END INTERFACE
- ️܀ See example
 - ↢
 
program main
use easifembase
implicit none
real(dfp), allocatable :: alphacoeff(:)
real(dfp), allocatable :: betacoeff(:)
integer(i4b) :: n
n = 5; call reallocate(alphacoeff, n, betacoeff, n)
call GetLegendreRecurrenceCoeff(n=n, &
& alphacoeff=alphacoeff, betacoeff=betacoeff)
call display( alphacoeff .colconcat. betacoeff, "ans = ")
end program main
See results
results
     ans =      
----------------
0.00000  2.00000
0.00000  0.33333
0.00000  0.26667
0.00000  0.25714
0.00000  0.25397
GetLegendreRecurrenceCoeff2
INTERFACE
  MODULE PURE SUBROUTINE GetLegendreRecurrenceCoeff2(n, A, B, C)
    INTEGER(I4B), INTENT(IN) :: n
    !! order of Legendre polynomial, it should be greater than 1
    REAL(DFP), INTENT(OUT) :: A(0:n - 1)
    !! size is n
    REAL(DFP), INTENT(OUT) :: B(0:n - 1)
    !! this coefficient is zero
    REAL(DFP), INTENT(OUT) :: C(0:n - 1)
    !! size is n
  END SUBROUTINE GetLegendreRecurrenceCoeff2
END INTERFACE
- ️܀ See example
 - ↢
 
program main
use easifembase
implicit none
real(dfp), allocatable :: A(:)
real(dfp), allocatable :: B(:)
real(dfp), allocatable :: C(:)
integer(i4b) :: n
n = 5; call reallocate(A, n, B, n, C, n)
call GetLegendreRecurrenceCoeff2(n=n, &
& A=A, B=B, C=C)
call display( A .colconcat. B .colconcat. C, "ans = ")
end program main
See results
results
          ans =          
-------------------------
1.00000  0.00000  0.00000
1.50000  0.00000  0.50000
1.66667  0.00000  0.66667
1.75000  0.00000  0.75000
1.80000  0.00000  0.80000