Learn R Programming

capn (version 2.0.0)

chebgrids: Generate Chebyshev Grids

Description

Generate a multi-dimensional Chebyshev grid over bounded intervals.

Usage

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

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 grid points.

Arguments

nnodes

A vector specifying the number of nodes in each dimension.

lb

A vector of lower bounds for each dimension.

ub

A vector of upper bounds for each dimension.

rtype

Type of return value. The default NULL returns a list. If rtype = "list", a list is returned. If rtype = "grid", a matrix is returned.

Details

For the \(i\)-th dimension, \(i = 1, 2, \ldots, d\), suppose a polynomial approximant \(s_{i}\) over a bounded interval \([a_{i}, b_{i}]\) is defined using Chebyshev nodes. Then, a \(d\)-dimensional Chebyshev grid is defined as:

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

This corresponds to all combinations of the marginal Chebyshev grids \(s_{i}\). Two types of return values are provided. rtype = "list" returns a list of length \(d\) containing the marginal grids, whereas rtype = "grid" returns a \( \left( \displaystyle \prod_{i=1}^{d} n_{i} \right) \times d\) matrix of all grid points.

See Also

chebnodegen

Examples

Run this code
## Chebyshev grid with two dimensions
chebgrids(c(5, 3), c(1, 1), c(2, 3))

## Returns the same result explicitly as a list
chebgrids(c(5, 3), c(1, 1), c(2, 3), rtype = "list")

## Returns a matrix of grid points over the same domain
chebgrids(c(5, 3), c(1, 1), c(2, 3), rtype = "grid")

## Chebyshev grid with one dimension
chebgrids(5, 1, 2)
chebnodegen(5, 1, 2)

## Chebyshev grid with three dimensions
chebgrids(c(3, 4, 5), c(1, 1, 1), c(2, 3, 4), rtype = "grid")

Run the code above in your browser using DataLab