Vandermonde Matrix

easynumpy_linalg

Implement vander(array).

Build the Vandermonde matrix with increasing powers: the element at row i, column j is array[i] ** j. A length-n vector gives an n × n matrix, e.g. [1, 2, 3][[1, 1, 1], [1, 2, 4], [1, 3, 9]].

np.vander is not allowed — construct it with broadcasting. No for/while loops.

Constraints
  • no vander
  • no for/while loops

Your solution

Edit vander and run the real pytest suite in your browser — no install required. Your code is saved locally.

⌘/Ctrl + ↵

Loading the Python runtime (first run only)…

Hints

Hint 1

Broadcast: array[:, None] raises each element to the powers np.arange(len(array)), giving increasing columns.