student::Kn
-- the vectorspace of
n-tupels over KThe domain student::Kn
represents the vectorspace of
n-tupels over the field F.
student::Kn(F)
student::Kn(n,F)
F |
- | a field, i.e. a domain of category Cat::Field . |
n |
- | a positive integer |
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
.student::Kn
(n,F)()
student::Kn
(n,F)(listofrows)
student::Kn
(n,F)(list)
student::Kn
(n,F)(indexfunc)
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). |
Cat::VectorSpace(F)
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)
.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)
callsDom::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
._mult(dom x, any
r)
_mult(any r ,dom
x)
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
.scalarMult
(x,r)
for the domain student::Kn
you can overload the
"_mult"
method of student::Kn
.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 | +- -+
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 | +- -+
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 | +- -+
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.