# linalg::vandermondeSolve

Solve a linear Vandermonde system

### Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

## Syntax

```linalg::vandermondeSolve(`v`, `y`, <Transposed>)
```

## Description

`linalg::vandermondeSolve(v, y)` returns the solution of the linear Vandermonde system with i = 1, …, n.

`linalg::vandermondeSolve` uses O(n2) elementary operations to solve the Vandermonde system. It is faster than the general solver `solve` and the linear solvers `linsolve`, `numeric::linsolve`, `linalg::matlinsolve` and `numeric::matlinsolve`.

The solution returned by `linalg::vandermondeSolve([v[i] \$ i=1..n], [y[i] \$ i=1..n])` yields the coefficients of the polynomial p(v) = x1 + x2v + ··· + xnvn - 1 interpolating the data table (v1, y1), …, (vn, yn), i.e.,

.

See Example 1.

## Examples

### Example 1

The Vandermonde points v and the right hand side y of the linear system are entered as vectors:

```delete y0, y1, y2: v := matrix([[0, 1, 2]]); y := matrix([[y0, y1, y2]])```

The solution vector is:

`x := linalg::vandermondeSolve(v, y)`

The solution yields the coefficients of the interpolating polynomial:

`P := v -> _plus(x[i+1]*v^i \$ i=0..2):`

through the points (0, y0), (1, y1), (2, y2):

`P(v[1]), P(v[2]), P(v[3])`

With the optional argument `Transposed`, the linear system with the transposed Vandermonde matrix corresponding to `v` is solved:

`linalg::vandermondeSolve(v, y, Transposed)`

`delete v, y, x, P:`

### Example 2

The Vandermonde points v and the right hand side y of the linear system are entered as 2×1 matrices:

`Mat := Dom::Matrix(Dom::ExpressionField(normal)):`
```delete v1, v2, y1, y2: v := Mat([v1, v2]): y := Mat([y1, y2]):```

We define the vectors over the domain `Dom::ExpressionField``(normal)` in order to simplify intermediate computations.

Next, we compute the solution of the corresponding Vandermonde system:

`x := linalg::vandermondeSolve(v, y)`

We construct the Vandermonde matrix `V` and verify the result:

`V := Mat([[1, v[1]], [1, v[2]]])`

`V * x`

`delete Mat, v, y, x, V:`

### Example 3

We solve a Vandermonde system over the field 7 (the integers modulo 7) represented by the domain `Dom::IntegerMod``(7)`:

```MatZ7 := Dom::Matrix(Dom::IntegerMod(7)): v := MatZ7([1, 2, 3]): y := MatZ7([0, 1, 2]):```
`linalg::vandermondeSolve(v, y)`

`delete MatZ7, v, y:`

## Parameters

 `v` A vector with distinct elements (a vector is an n×1 or 1 ×n matrix of category `Cat::Matrix`). Alternatively, a list with n distinct elements is also accepted. `y` A vector of the same dimension and domain type as `v`. Alternatively, a list with n elements is also accepted.

## Options

 `Transposed` Returns the solution of the transposed system with i = 1, …, n.

## Return Values

Vector of the same domain type as `y`.

## Algorithms

The Vandermonde matrix

generated by v = [v1, …, vn] is invertible if and only if the vi are distinct.

The vector returned by `linalg::vandermondeSolve(x, y)` is the unique solution of .

The vector x returned by `linalg::vandermondeSolve(x, y, Transposed)` is the unique solution of .