cheb_ser_eval Function

public function cheb_ser_eval(n, c, x) result(res)

f(x), x E [-1,1] is given by the following appproximation formula in terms of Chebyshev polynomials:

f(x) = (1/2)*c_0*T_0(x) + ... + c_n*T_n(x)

Given the vector of coefficients, c(0), ..., c(n), this routine evaluates the above sum at a point x E [-1,1].

Clenshaw recursion formula is used to evaluate the sum.

Reference

William Press, Brian Flannery, Saul Teukolsky, William Vetterling, Numerical Recipes in FORTRAN: The Art of Scientific Computing, Second Edition, Cambridge University Press, 1992, Page: 185--187

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: n

Highest degree of T_n (x).

real(kind=rp), intent(in), dimension(0:n) :: c

Chebyshev coefficients

real(kind=rp), intent(in) :: x

x E [-1,1] the point where the sum is to be evaluated.

Return Value real(kind=rp)