The function returns the Vandermode matrix of a numeric vector, x, whose columns are the vector raised to the powers 0:n.

vandermode(x, n)

Arguments

x

a numeric vector

n

a numeric scalar

Value

a matrix of size length(x) x n

Examples

vandermode(1:5, 4)
#>      [,1] [,2] [,3] [,4]
#> [1,]    1    1    1    1
#> [2,]    1    2    4    8
#> [3,]    1    3    9   27
#> [4,]    1    4   16   64
#> [5,]    1    5   25  125