View source: R/ChebCoefficients.R
| ChebCoefficients | R Documentation |
ChebCoefficients(values) converts function values, say values = f(x), evaluated
at Chebyshev points of the 2nd kind, say n-dimensional x, to
n-dimensional Chebyshev coefficients.
ChebCoefficients(values)
values |
function values evaluated at Chebyshev points of the 2nd kind |
c = ChebCoefficients(values) returns the n-dimensional vector of coefficients
such that f(x) = C(1)*T_{0}(x) + C(2)*T_{1}(x)+ ... +
C(N)*T_{n-1}(x) (where T_{k}(x) denotes the k-th 1st-kind Chebyshev
polynomial) interpolates the data [values(1); ... ; values(n)] at Chebyshev
points x = [x(1); ... ; x(n)] of the 2nd kind.
If values is an (n x m)-matrix, then C = ChebCoefficients(values) returns the
(n x m)-matrix of coefficients C.
Ver.: 15-Nov-2021 17:33:19 (consistent with Matlab CharFunTool v1.3.0, 28-May-2021 14:28:24).
Other Utility Function:
ChebPoints(),
ChebPolyValues(),
ChebPoly(),
ChebValues(),
GammaLog(),
GammaMultiLog(),
GammaMulti(),
GammaZX(),
Hypergeom1F1MatApprox(),
Hypergeom1F1Mat(),
Hypergeom2F1Mat(),
Hypergeom2F1(),
HypergeompFqMat(),
InterpChebValues(),
hypergeom1F1(),
interpBarycentric()
## EXAMPLE1 (Chebyshev coefficients of the Sine function on (-pi,pi))
# n <- 2^5+1
# domain <- c(-pi,pi)
# x <- ChebPoints(n,domain)
# f <-list( sin(x[[1]]))
# coeffs <- ChebCoefficients(f)
# print(list(x[[1]], coeffs))
# x <- seq(-pi,pi,length.out=100)
# pval <- ChebPolyValues(coeffs,x,domain)
# plotReIm(function(x)
# pval,x,
# xlab="x",
# ylab="Chebyshev polynomial",
# title="Chebyshev Polynomial Values Specified by its Coefficients")
## EXAMPLE2 (Chebyshev coefficients of the Sine and the Cosine on (-pi,pi))
n <- 2^5+1
domain <- c(-pi,pi)
x <- ChebPoints(n,domain)
f <-list(sin(x[[1]]), cos(x[[1]]))
coeffs <- ChebCoefficients(f)
print(list(x[[1]], coeffs))
x <- seq(-pi,pi,length.out=100)
pval <- ChebPolyValues(coeffs,x,domain)
pval1<-list()
for (i in 1:length(pval[1,])) {
pval1[[i]]<-pval[,i]
}
# matplot(x, pval,type="o",col=c("red","green"),lty=c(1,1),
# xlab="x",
# ylab="Chebyshev polynomial",
# main="Chebyshev Polynomial Values Specified by its Coefficients")
plotReIm3( pval1,
x,
title="Chebyshev Polynomial Values Specified by its Coefficients",
xlab = "x",
ylab ="Chebyshev polynomial" )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.