Generate Vandermonde matrix from a numeric vector.

vander(x)

Arguments

x

Numeric vector

Details

Generates the usual Vandermonde matrix from a numeric vector, e.g. applied when fitting a polynomial to given points. Complex values are allowed.

Value

Vandermonde matrix of dimension n where n = length(x).

Examples

  vander(c(1:10))
#>             [,1]      [,2]     [,3]    [,4]   [,5]  [,6] [,7] [,8] [,9] [,10]
#>  [1,]          1         1        1       1      1     1    1    1    1     1
#>  [2,]        512       256      128      64     32    16    8    4    2     1
#>  [3,]      19683      6561     2187     729    243    81   27    9    3     1
#>  [4,]     262144     65536    16384    4096   1024   256   64   16    4     1
#>  [5,]    1953125    390625    78125   15625   3125   625  125   25    5     1
#>  [6,]   10077696   1679616   279936   46656   7776  1296  216   36    6     1
#>  [7,]   40353607   5764801   823543  117649  16807  2401  343   49    7     1
#>  [8,]  134217728  16777216  2097152  262144  32768  4096  512   64    8     1
#>  [9,]  387420489  43046721  4782969  531441  59049  6561  729   81    9     1
#> [10,] 1000000000 100000000 10000000 1000000 100000 10000 1000  100   10     1