## `student::Kn` -- the vectorspace of n-tupels over K

#### Introduction

The domain `student::Kn` represents the vectorspace of n-tupels over the field F.

#### Domain

`student::Kn(F)`
`student::Kn(n,F)`

#### Parameters

`F` | - | a field, i.e. a domain of category `Cat::Field`.
`n` | - | a positive integer

#### Details

- The domain `student::Kn` represents the vector space of `n`-tuples over the field `F`. The default value of `n` is `1`. `F` must be a domain of category `Cat::Field`.

#### Creating Elements

``student::Kn`(n,F)()`
``student::Kn`(n,F)(listofrows)`
``student::Kn`(n,F)(list)`
``student::Kn`(n,F)(indexfunc)`

#### Parameters

`list` | - | list of vector components.
`listofrows` | - | list of (at most) `n` rows. Each row is a list of vector components.
`indexfunc` | - | function or functional expression in two parameters (the row and column index).

#### Categories

`Cat::VectorSpace(F)`

,`Cat::Matrix(F)`

#### Related Domains

`Dom::MatrixGroup`

#### Details

- Elements of `student::Kn` are contructed by a call to the element constructors of `Dom::MatrixGroup(n,1,F)`. Refer to the corresponding methods of `Dom::MatrixGroup(n,1,F)`.
- The call `student::Kn``(n, F)()` returns the n-dimensional zero vector. Note that the zero vector is defined by the entry `"zero"`. See also Example 3.
- `student::Kn``(n, F)(listofrows)` creates a vector with `n` components v1, v2, ..., vn, when `listofrows` is the list [[v1], [v2], ..., [vn]]. Internally `student::Kn``(n, F)(listofrows)` calls `Dom::MatrixGroup(n,1,F)(n,1,listofrows)`. See there for further information.
- `student::Kn``(n,F)(list)` creates the vector with `n` components whose components are the entries of `list`. Internally `student::Kn``(n, F)(list)` calls `Dom::MatrixGroup(n,1,F)(n,1,list)`. See there for further information.
- `student::Kn``(n,F)(indexfunc)` returns the vector whose i-th component is the value of the function call `indexfunc(i,1)`. Internally `student::Kn``(n, F)(indexfunc)` calls
  `Dom::MatrixGroup(n,1,F)(n,1,indexfunc)`. See there for further information.
- `student::Kn(`n, F`)` has the domain `Dom::MatrixGroup(n,1,F)` as its super domain, i.e., it inherits each method which is defined by `Dom::MatrixGroup(n,1,F)` and not re-implemented by `student::Kn(`n, F`)`. Methods described below are re-implemented by `student::Kn`.

#### Method _mult: multiplies with a scalar

- `_mult(dom x, any r)`
- `_mult(any r ,dom x)`
- - If `r` is of type `student::Kn`(n,F) this method returns `FAIL`. Otherwise if there is no method `"scalarMult"``(x,r)` for the domain `student::Kn`(n,F) defined, the method `"_mult"` of `Dom::MatrixGroup(n,1,F)` is used to multiply `x` and `r`. In general this means `x` is multiplied with the scalar value `r`.
  - By defining the method `scalarMult``(x,r)` for the domain `student::Kn` you can overload the `"_mult"` method of `student::Kn`.

#### Example 1

Let us create the vector space of the 3-tupel over the field `Dom::Real`:

    >> R3 := student::Kn(3,Dom::Real)

                             student::Kn(3, Dom::Real)

Now we create some elements of this domain in different ways:

    >> u := R3([1,2,3]);
       v := R3([[2],[3],[4]]);
       w := R3()

                                      +-   -+
                                      |  1  |
                                      |     |
                                      |  2  |
                                      |     |
                                      |  3  |
                                      +-   -+

                                      +-   -+
                                      |  2  |
                                      |     |
                                      |  3  |
                                      |     |
                                      |  4  |
                                      +-   -+

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

We perform some calculation with the just created elements. We add the three vectors v, w and u of the vectorspace, multiply the vector w with the scalar 3 and the vector v with the scalar -4:

    >> v + w + u;
       3*w;
       v*(-4)

                                      +-   -+
                                      |  3  |
                                      |     |
                                      |  5  |
                                      |     |
                                      |  7  |
                                      +-   -+

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

                                     +-     -+
                                     |   -8  |
                                     |       |
                                     |  -12  |
                                     |       |
                                     |  -16  |
                                     +-     -+

#### Example 2

Let us see how we can use a function for creating elements of the domain. The function `f` computes the square of the given number. So the entry in the i-th row of the constructed vector will be i^2.

    >> f := i -> i^2:
       R3 := student::Kn(3,Dom::Real);
       R4 := student::Kn(4,Dom::Real);
       v := R3(f);
       w := R4(f)

                             student::Kn(3, Dom::Real)

                             student::Kn(4, Dom::Real)

                                      +-   -+
                                      |  1  |
                                      |     |
                                      |  4  |
                                      |     |
                                      |  9  |
                                      +-   -+

                                     +-    -+
                                     |   1  |
                                     |      |
                                     |   4  |
                                     |      |
                                     |   9  |
                                     |      |
                                     |  16  |
                                     +-    -+

#### Example 3

The zero vector is defined by the entry `"zero"` as we can see in the following example:

    >> R3 := student::Kn(3,Dom::Real):
       R3::zero();
       v := R3([[2],[3],[4]]);
       v - R3::zero()

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

                                      +-   -+
                                      |  2  |
                                      |     |
                                      |  3  |
                                      |     |
                                      |  4  |
                                      +-   -+

                                      +-   -+
                                      |  2  |
                                      |     |
                                      |  3  |
                                      |     |
                                      |  4  |
                                      +-   -+

#### Super-Domain

`Dom::MatrixGroup`

#### Axioms

if `F` has `Ax::canonicalRep`
`Ax::canonicalRep`

#### Background

- If the user defines a method `scalarMult` to overload the `"_mult"` method of `student::Kn` he is responsible to define a legal scalar multiplication. This means the defined scalar multiplication has to fulfill that the vector space of `n`-tuples over the field `F` is still a vector space. This is not checked by the domain `student::Kn` themself.

#### Changes

- no changes

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