## `linalg::basis` -- basis for a vector space

#### Introduction

`linalg::basis``(S)` returns a basis for the vector space spanned by the vectors in the set or list S.

#### Call(s)

`linalg::basis(S)`

#### Parameters

`S` | - | a set or list of n-dimensional vectors; a vector is a n x 1 or 1 x n matrix of a domain of category `Cat::Matrix`

#### Returns

a set or a list of vectors, respectively.

#### Related Functions

`linalg::intBasis`, `linalg::sumBasis`, `lllint`

#### Details

- `linalg::basis``(S)` removes those vectors in `S` that are linearly dependent on other vectors in `S`. The result is a basis for the vector space spanned by the vectors in `S`.
- For an ordered basis of vectors, `S` should be a list of vectors.
- The vectors in `S` must be defined over the same component ring.
- The component ring of the vectors in `S` must be a field, i.e., it must be of category `Cat::Field`.

#### Example 1

We define the domain of matrices over Q:

    >> MatQ := Dom::Matrix(Dom::Rational):

and compute a basis for the vector space spanned by the vectors [3,-2], [1,0] and [5,-3]:

    >> v1 := MatQ([3, -2]): v2 := MatQ([1, 0]): v3 := MatQ([5, -3]):
       linalg::basis([v1, v2, v3])

                              -- +-    -+  +-   -+ --
                              |  |   3  |  |  1  |  |
                              |  |      |, |     |  |
                              |  |  -2  |  |  0  |  |
                              -- +-    -+  +-   -+ --

If not a list but a set of vectors is given, then the basis returned contains the same vectors. But the order of the vectors in the set depends on the internal order (see `sysorder` and `DOM_SET`), i.e., the order of the vectors appears to be random:

    >> b := linalg::basis({v1, v2, v3}): op(b, 1)

                                      +-   -+
                                      |  1  |
                                      |     |
                                      |  0  |
                                      +-   -+

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000