ChebPolyValues: Values of the Chebyshev polynomial

View source: R/ChebPolyValues.R

ChebPolyValuesR Documentation

Values of the Chebyshev polynomial

Description

ChebPolyValues(coeffs,x,domain) evaluates the values of the Chebyshev polynomial specified by its coefficients at the specified grid of points x, where x = xMin + xx*(xMax-xMin), with domain = [xMin, xMax] and xx being the grid of points from the interval [-1,1].

Usage

ChebPolyValues(coeffs, x, domain)

Arguments

coeffs

Chebyshev coefficients

x

points, in which we want to compute the value of polynomial.

domain

vector containing lower and upper bound of interval.

Value

Function returns values of nth order Chebysev polynomial of the first kind evaluated in points x.

Note

Ver.: 15-Nov-2021 18:19:46 (consistent with Matlab CharFunTool v1.3.0, 28-May-2021 14:28:24).

See Also

Other Utility Function: ChebCoefficients(), ChebPoints(), ChebPoly(), ChebValues(), GammaLog(), GammaMultiLog(), GammaMulti(), GammaZX(), Hypergeom1F1MatApprox(), Hypergeom1F1Mat(), Hypergeom2F1Mat(), Hypergeom2F1(), HypergeompFqMat(), InterpChebValues(), hypergeom1F1(), interpBarycentric()

Examples

## EXAMPLE1 (Chebyshev polynomial values specified by coefficients of Sine)
n <- 2^5+1
domain <- c(-pi,pi)
nodes  <- ChebPoints(n,domain)
f <-list(sin(nodes[[1]]))
coeffs <- ChebCoefficients(f)
x <- seq(-pi,pi,length.out=100)
pval <- ChebPolyValues(coeffs,x)
plotReIm(function(x)
           pval,x,
           xlab = "x",
           ylab ="Chebyshev polynomial",
           title ="Chebyshev Polynomial Specified by its Coefficients")

## EXAMPLE2 (Chebyshev polynomial values of the Sine and Cosine functions)
n <- 2^5+1
domain <- c(-pi,pi)
nodes  <- ChebPoints(n,domain)
f <- list(sin(nodes[[1]]), cos(nodes[[1]]), sin(nodes[[1]])*cos(nodes[[1]]))
coeffs <- ChebCoefficients(f);
x <- seq(-pi,pi,length.out=101)
pval_x <- ChebPolyValues(coeffs,c(),domain)
pval_x1<-list()
for (i in 1:length(pval_x[1,])) {
    pval_x1[[i]]   <- pval_x[,i]
  }
plotReIm3(
  pval_x1,x,
  xlab="x",
  ylab="Chebyshev polynomial",
  title="Chebyshev Polynomial Specified by its Coefficients")

## EXAMPLE3 (Chebyshev polynomial values of the Normal PDF and CDF)
n <- 2^7+1
domain <- c(-8, 8)
nodes  <- ChebPoints(n,domain)
f <- list(dnorm(nodes[[1]]), pnorm(nodes[[1]]))
coeffs <- ChebCoefficients(f)
x <- seq(-4,4,length.out=101)
pval_x <- ChebPolyValues(coeffs,x,domain)
pval_x1 <-list()
for (i in 1:length(pval_x[1,])) {
    pval_x1[[i]] <- pval_x[,i]
    }

plotReIm3(
pval_x1,x, title="Chebyshev Polynomial Values Specified by its Coefficients",
xlab = "x",
ylab ="Chebyshev polynomial" )


gajdosandrej/CharFunToolR documentation built on June 3, 2024, 7:46 p.m.