# VectorSpaceBasis RΒΆ

vsbasis.spad line 1 [edit on github]

R: Field

The domain `VectorSpaceBasis F`

implements subspaces of finite dimensional vector spaces over a field `F`

. A subspace is represented by a list of linearly independent coordinate vectors which constitute a basis. The empty list represents the space of dimension 0.

- 0: %
`0`

creates the empty basis describing the space with the zero vector. The length of this zero vector is undefined.

- *: (%, %) -> %
`b1*b2`

computes a basis of the intersection of two subspaces.

- +: (%, %) -> %
`B1+B2`

computes a basis of the sum of two subspaces.

- basis: List Vector R -> %
`basis LV`

extracts a basis of the subspace spanned by the list of vectors`LV`

.

- canonicalBasis: NonNegativeInteger -> %
`canonicalBasis n`

builds the canonical basis of the vector space of dimension`n`

.

- coerce: % -> List Vector R
`coerce b`

returns the basis as a list of vectors.- coerce: % -> OutputForm
from CoercibleTo OutputForm

- columnSpace: Matrix R -> %
`columnSpace M`

builds a basis of the image space of the linear transformation defined by the matrix`M`

. This function calls the`columnSpace`

from the`Matrix`

domain. Only the signature changes.

- complementSpace: % -> %
`complementSpace B`

builds a complement space of the basis`B`

from some vectors of the canonical basis. This function fails with the empty basis.

- complementSpace: (%, NonNegativeInteger) -> %
`complementSpace(B, n)`

builds a complement space of the basis`B`

from some vectors of the canonical basis`B`

. The integer`n`

provides the length of the vectors in the case of the empty basis.

- complementSpace: (List Vector R, NonNegativeInteger) -> %
`complementSpace(Lv, n)`

builds a complement space of the subspace spanned by the list of vectors`LV`

. The integer`n`

provides the length of the vectors in the case of the empty basis.

- complementSpace: List Vector R -> %
`complementSpace Lv`

builds a complement space of the subspace spanned by the list of vectors`LV`

. This function fails with the empty basis.

- coordinates: (Vector R, %) -> Vector R
`coordinates(v, B)`

computes the coordinates of the vector`v`

in the basis`B`

if possible and produces an error otherwise.

- coordinatesIfCan: (Vector R, %) -> Union(Vector R, failed)
`coordinatesIfCan(v, B)`

computes the coordinates of the vector`v`

in the basis`B`

if possible and returns`"failed"`

otherwise.

- intBasis: (%, %) -> %
`intBasis(B1, B2)`

computes a basis of the intersection of the two subspaces.

- intBasis: (List Vector R, List Vector R) -> %
`intBasis(Lv1, Lv2)`

computes a basis of the intersection of the two subspaces spanned by the vectors of`Lv1`

and`Lv2`

.

- intBasis: List % -> %
`intBasis Lb`

computes a basis of the intersection of the list of subspaces represented by`LLv`

.

- intBasis: List List Vector R -> %
`intBasis LLv`

computes a basis of the intersection of the list of subspaces represented by`LLv`

.

- member?: (Vector R, %) -> Boolean
`member?(v, B)`

tests if the vector`v`

is in the subspace spanned by`B`

.

- nullSpace: Matrix R -> %
`nullSpace M`

builds a basis of the kernel of the linear transformation defined by the matrix`M`

. This function calls the function`nullSpace`

from the`Matrix`

domain. Only the signature changes.

- rank: % -> NonNegativeInteger
`rank b`

computes the rank of a basis, i.e. the number of vectors in the basis.

- rank: List Vector R -> NonNegativeInteger
`rank Lv`

computes the rank of a list of vectors.

- subspace?: (%, %) -> Boolean
`subspace?(B1, B2)`

tests if the first space is included in the second.

- sumBasis: (%, %) -> %
`sumBasis(B1, B2)`

computes a basis of the sum of the two subspaces.

- sumBasis: (List Vector R, List Vector R) -> %
`sumBasis(Lv1, Lv2)`

computes a basis of the sum of the two subspaces spanned by the vectors of`Lv1`

and`Lv2`

.

- sumBasis: List % -> %
`sumBasis Lb`

computes a basis of the sum of list of subspaces. This function is slightly more efficient than`reduce(sumBasis, Lb)`

.