Subroutine to convert Chebyshev (A) to Legendre (B) coefficients.
This is Piessens Algorithm, which can be found as Algorithm 473 in the Communications of the ACM, January 1974, Volume 17, Number 1, page 25. It is slightly modified to account for Fortran 90 practices.
Algorithm makes use of the recurrence relation, by which the integral of the product of the nth Legendre polynomial with the kth Chebyshev polynomial I_{n,k} is given by:
I_{n,k+2} = {[(k-1)k - n(n+1)](k+2) / ([(k+3)(k+2) - n(n+1)]k)} * I_{n,k} with I_{0,0} and I_{n,k} = 0 if k < n. For I_{n,n} we have: I_{n,n} = 2^{2n}(n!)^2/(2n+1)! if n > 0
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=rk), | intent(in) | :: | A(n) | Known coefficients of the Chebyshev approximation. |
||
real(kind=rk), | intent(out) | :: | B(n) | Computed corresponding coefficients of the Legendre approximation. |
||
integer, | intent(in) | :: | n | Number of coefficients. |
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
real(kind=rk), | private | :: | ak | ||||
real(kind=rk), | private | :: | al | ||||
real(kind=rk), | private | :: | bb | ||||
real(kind=rk), | private | :: | c | ||||
real(kind=rk), | private | :: | d | ||||
integer, | private | :: | k | ||||
integer, | private | :: | l | ||||
integer, | private | :: | ll |