Learn R Programming

capn (version 1.0.0)

chebgrids: Generating Chebyshev grids

Description

This function generates a grid of multi-dimensional Chebyshev nodes.

Usage

chebgrids(nnodes, lb, ub, rtype = NULL)

Arguments

nnodes

An array of numbers of nodes

lb

An array of lower bounds

ub

An array of upper bounds

rtype

A type of results; default is NULL that returns a list class; if rtype = list, returns a list class; if rtype = grid, returns a matrix class.

Value

A list with \(d\) elements of Chebyshev nodes or a \( \left( \displaystyle \prod_{i=1}^{d} n_{i} \right) \times d\) matrix of Chebyshev grids

Details

For the \(i\)-th dimension of \(i = 1, 2, \cdots, d\), suppose a polynomial approximant \(s_{i}\) over a bounded interval \([a_{i},b_{i}]\) is defined by Chebysev nodes. Then, a \(d\)-dimensional Chebyshev grids can be defined as:

\(\mathbf{S} = \left\{ (s_{1},s_{2},\cdots,s_{d}) \vert a_{i} \leq s_{1} \leq b_{i}, i = 1, 2, \cdots, d \right\} \).

This is all combinations of \(s_{i}\). Two types of results are provided. 'rtype = list' provides a list of \(d\) dimensions wherease 'rtype = grids' creates a \( \left( \displaystyle \prod_{i=1}^{d} n_{i} \right) \times d\) matrix.

See Also

chebnodegen

Examples

Run this code
## Chebyshev grids with two-dimension
chebgrids(c(5,3), c(1,1), c(2,3))
# Returns the same results
chebgrids(c(5,3), c(1,1), c(2,3), rtype='list')
## Returns a matrix grids with the same domain
chebgrids(c(5,3), c(1,1), c(2,3), rtype='grid')
## Chebyshev grids with one-dimension
chebgrids(5,1,2)
chebnodegen(5,1,2)
## Chebyshev grids with three stock
chebgrids(c(3,4,5),c(1,1,1),c(2,3,4),rtype='grid')

Run the code above in your browser using DataLab