chebgrids: Generating Chebyshev grids

Description Usage Arguments Details Value See Also Examples

View source: R/definefuns.R

Description

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

Usage

1
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.

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} = ≤ft\{ (s_{1},s_{2},\cdots,s_{d}) \vert a_{i} ≤q s_{1} ≤q 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 ≤ft( \displaystyle ∏_{i=1}^{d} n_{i} \right) \times d matrix.

Value

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

See Also

chebnodegen

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## 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')

Example output

[[1]]
[1] 1.024472 1.206107 1.500000 1.793893 1.975528

[[2]]
[1] 1.133975 2.000000 2.866025

[[1]]
[1] 1.024472 1.206107 1.500000 1.793893 1.975528

[[2]]
[1] 1.133975 2.000000 2.866025

          Var1     Var2
 [1,] 1.024472 1.133975
 [2,] 1.206107 1.133975
 [3,] 1.500000 1.133975
 [4,] 1.793893 1.133975
 [5,] 1.975528 1.133975
 [6,] 1.024472 2.000000
 [7,] 1.206107 2.000000
 [8,] 1.500000 2.000000
 [9,] 1.793893 2.000000
[10,] 1.975528 2.000000
[11,] 1.024472 2.866025
[12,] 1.206107 2.866025
[13,] 1.500000 2.866025
[14,] 1.793893 2.866025
[15,] 1.975528 2.866025
[[1]]
[1] 1.024472 1.206107 1.500000 1.793893 1.975528

[1] 1.024472 1.206107 1.500000 1.793893 1.975528
          Var1     Var2     Var3
 [1,] 1.066987 1.076120 1.073415
 [2,] 1.500000 1.076120 1.073415
 [3,] 1.933013 1.076120 1.073415
 [4,] 1.066987 1.617317 1.073415
 [5,] 1.500000 1.617317 1.073415
 [6,] 1.933013 1.617317 1.073415
 [7,] 1.066987 2.382683 1.073415
 [8,] 1.500000 2.382683 1.073415
 [9,] 1.933013 2.382683 1.073415
[10,] 1.066987 2.923880 1.073415
[11,] 1.500000 2.923880 1.073415
[12,] 1.933013 2.923880 1.073415
[13,] 1.066987 1.076120 1.618322
[14,] 1.500000 1.076120 1.618322
[15,] 1.933013 1.076120 1.618322
[16,] 1.066987 1.617317 1.618322
[17,] 1.500000 1.617317 1.618322
[18,] 1.933013 1.617317 1.618322
[19,] 1.066987 2.382683 1.618322
[20,] 1.500000 2.382683 1.618322
[21,] 1.933013 2.382683 1.618322
[22,] 1.066987 2.923880 1.618322
[23,] 1.500000 2.923880 1.618322
[24,] 1.933013 2.923880 1.618322
[25,] 1.066987 1.076120 2.500000
[26,] 1.500000 1.076120 2.500000
[27,] 1.933013 1.076120 2.500000
[28,] 1.066987 1.617317 2.500000
[29,] 1.500000 1.617317 2.500000
[30,] 1.933013 1.617317 2.500000
[31,] 1.066987 2.382683 2.500000
[32,] 1.500000 2.382683 2.500000
[33,] 1.933013 2.382683 2.500000
[34,] 1.066987 2.923880 2.500000
[35,] 1.500000 2.923880 2.500000
[36,] 1.933013 2.923880 2.500000
[37,] 1.066987 1.076120 3.381678
[38,] 1.500000 1.076120 3.381678
[39,] 1.933013 1.076120 3.381678
[40,] 1.066987 1.617317 3.381678
[41,] 1.500000 1.617317 3.381678
[42,] 1.933013 1.617317 3.381678
[43,] 1.066987 2.382683 3.381678
[44,] 1.500000 2.382683 3.381678
[45,] 1.933013 2.382683 3.381678
[46,] 1.066987 2.923880 3.381678
[47,] 1.500000 2.923880 3.381678
[48,] 1.933013 2.923880 3.381678
[49,] 1.066987 1.076120 3.926585
[50,] 1.500000 1.076120 3.926585
[51,] 1.933013 1.076120 3.926585
[52,] 1.066987 1.617317 3.926585
[53,] 1.500000 1.617317 3.926585
[54,] 1.933013 1.617317 3.926585
[55,] 1.066987 2.382683 3.926585
[56,] 1.500000 2.382683 3.926585
[57,] 1.933013 2.382683 3.926585
[58,] 1.066987 2.923880 3.926585
[59,] 1.500000 2.923880 3.926585
[60,] 1.933013 2.923880 3.926585

capn documentation built on May 1, 2019, 11:15 p.m.

Related to chebgrids in capn...