InterpChebValues: Evaluates function by using Chebyshev polynomial...

View source: R/InterpChebValues.R

InterpChebValuesR Documentation

Evaluates function by using Chebyshev polynomial approximation

Description

InterpChebValues(values,x,domain) evaluates the function fun by using Chebyshev polynomial approximation specified by the function values evaluated at Chebyshev points with specified domain.

Usage

InterpChebValues(values, x, domain)

Arguments

values

function values evaluated at Chebyshev points of the 2nd kind.

x

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

domain

vector containing lower and upper bound of interval.

Value

Function returns the function fun by using Chebyshev polynomial approximation specified by the function values evaluated at Chebyshev points with specified domain.

Note

Ver.: 16-Nov-2021 15:52:07 (consistent with Matlab CharFunTool v1.3.0, 28-May-2021 14:28:24).

See Also

Other Utility Function: ChebCoefficients(), ChebPoints(), ChebPolyValues(), ChebPoly(), ChebValues(), GammaLog(), GammaMultiLog(), GammaMulti(), GammaZX(), Hypergeom1F1MatApprox(), Hypergeom1F1Mat(), Hypergeom2F1Mat(), Hypergeom2F1(), HypergeompFqMat(), 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.