## `linalg::sumBasis` -- basis for the sum of vector spaces

#### Introduction

`linalg::sumBasis``(S1, S2...)` returns a basis of the vector space V[1] + V[2] + ..., where V[i] denotes the vector space spanned by the vectors in S[i].

#### Call(s)

`linalg::sumBasis(S1, S2...)`

#### Parameters

`S1, S2...` | - | a set or list of vectors of the same dimension (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, according to the domain type of the parameter `S1`.

#### Related Functions

`linalg::basis`, `linalg::intBasis`, `linalg::rank`

#### Details

- To obtain an ordered basis, `S1, S2...` should be given as lists of vectors.
- A basis of the zero-dimensional space is the empty set or list, respectively.
- The given vectors must be defined over the same component ring, which must be a field, i.e., a domain of category `Cat::Field`.

#### Example 1

We define three vectors v[1],v[2],v[3] over Q:

    >> MatQ := Dom::Matrix(Dom::Rational):
       v1 := MatQ([[3, -2]]); v2 := MatQ([[1, 0]]); v3 := MatQ([[5, -3]])

                                     +-     -+
                                     | 3, -2 |
                                     +-     -+

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

                                     +-     -+
                                     | 5, -3 |
                                     +-     -+

A basis of the vector space V1 + V2 + V3 with V1=<{v[1],v[2],v[3]}>, V2=<{v[1],v[3]}> and V3=<{v[1]+v[2],v[2],v[1]+v[3]}> is:

    >> linalg::sumBasis([v1, v2, v3], [v1, v3], [v1 + v2, v2, v1 + v3])

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

#### Example 2

The following set of two vectors:

    >> MatQ := Dom::Matrix(Dom::Rational):
       S1 := {MatQ([1, 2, 3]), MatQ([-1, 0, 2])}

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

is a basis of a two-dimensional subspace of Q^3:

    >> linalg::rank(S1)

                                         2

The same holds for the following set:

    >> S2 := {MatQ([0, 2, 3]), MatQ([2, 4, 6])};
       linalg::rank(S2)

                               { +-   -+  +-   -+ }
                               { |  0  |  |  2  | }
                               { |     |  |     | }
                               { |  2  |, |  4  | }
                               { |     |  |     | }
                               { |  3  |  |  6  | }
                               { +-   -+  +-   -+ }

                                         2

The sum of the corresponding two subspaces is the vector space Q^3:

    >> Q3 := linalg::sumBasis(S1, S2)

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

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