ChebPoints: Chebpoints on the given interval

View source: R/ChebPoints.R

ChebPointsR Documentation

Chebpoints on the given interval

Description

ChebPoints(N, interval) evaluates N chebpoints on the given interval [a,b].

Usage

ChebPoints(N, interval)

Arguments

N

number of chebpoints required.

interval

vector containing lower and upper bound of interval.

Value

Function returns N chebpoints on the given interval.

Note

Ver.: 16-Sep-2018 21:16:55 (consistent with Matlab CharFunTool v1.3.0, 24-Jul-2017 10:06:48).

See Also

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

Examples

## EXAMPLE 1
# Barycentric interpolant of the Sine function on (-pi,pi)
domain<-c(-pi,pi)
x <- ChebPoints(32, c(-pi, pi))
f <- list(sin(x[[1]]))
xNew <- seq(from = -pi,
            to = pi,
            length.out = 201)
fNew <- interpBarycentric(x[[1]], f[[1]], xNew)[[2]]
fCheb<-InterpChebValues(f,xNew,domain)
fTrue<-sin(xNew)
plot(
        x[[1]],
        f[[1]],
        type = "p",
        xlab = "",
        ylab = "",
        main = "",
        pch = 20,
        col = "red",
        cex = 1.5
)
lines(xNew, fNew, col = "blue",  lwd = 2)
print(list(
        "fTrue"=fTrue,
        "fCheb"=fCheb,
        "xNew" = xNew,
        "fNew" = fNew,
        "sin(xNew)" = sin(xNew)
))

## EXAMPLE 2
#Integral of the Sine function on the interval (0,pi)
domain<-c(0,pi)
x<-ChebPoints(32,domain)
f<-list(sin(x[[1]]))
Itrue<-2
Icalc<-t(x[[2]])%*%f[[1]]
print(list(
        "Itrue"=Itrue,
        "Icalc"=Icalc
))


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