A vector is created using angled brackets:
[> v := <x, x*y, x - y, x^2>;
$v := \begin{pmatrix} x \\ xy \\ x - y \\ x^2 \end{pmatrix}$
As noted on the main page, Maple does not work with abstract vectors, but rather, the vector must have a given dimension, each entry must have a value, but those values can contain algebraic expressions.
Note: we do not use u as a vector name, as u is likely aliased to Heaviside.
There is also a vector constructor, where the first argument is the dimension. If you pass only the dimension, the default is the zero vector:
[> z := Vector( 5 );
$z := \begin{pmatrix} 0 \\ 0 \\ 0 \\ 0 \\ 0 \end{pmatrix}$
There are two options of interest. The fill option allows each entry of the vector to be assigned the same value:
[> c := Vector( 3, 'fill' = 4.5 );
$c := \begin{pmatrix} 4.5 \\ 4.5 \\ 4.5 \end{pmatrix}$
The next is symbol, where you can presribe a symbol to be indexed for each of the entries. My suggestion is that if you are assigning the vector to the variable w, then the symbol should be %w. In this way, the two are related, but you cannot assign to any of the entries:
[> w := Vector( 6, 'symbol' = %w );
$w := \begin{pmatrix} w_1 \\ w_2 \\ w_3 \\ w_4 \\ w_5 \\ w_6 \end{pmatrix}$
You can now substitute a value into the vector for any one of the entries:
[> eval( w, [%w[1] = 5, %w[4] = 6] );
$\begin{pmatrix} 5 \\ w_2 \\ w_3 \\ 6 \\ w_5 \\ v_6 \end{pmatrix}$
In certain applications, it may be useful to take a vector and either prepend or append additional values. For example, when approximating a solution to a boundary-value problem, once the approximations at the internal points are solved for, it is useful to prepend and append the two boundary values:
[> us := <3.543, 3.759, 3.810, 3.798>;
$\begin{pmatrix} 3.543 \\ 3.759 \\ 3.810 \\ 3.798 \end{pmatrix}$
[> us := <3.326, us, 3.783>;
$\begin{pmatrix} 3.326 \\ 3.543 \\ 3.759 \\ 3.810 \\ 3.798 \\ 3.783 \end{pmatrix}$
The entries of a vector may be accesses or assigned to usign indexing, just like lists:
[> v[3];
$x - y$
[> v[3] := x^2 - y^2 - 1;
$v_3 := x^2 - y^2 - 1$
[> v;
$u := \begin{pmatrix} x \\ xy \\ x^2 - y^2 - 1 \\ x^2 \end{pmatrix}$
You can also extract a sub-vector using the range operator:
[> us[2..-2];
$\begin{pmatrix} 3.543 \\ 3.759 \\ 3.810 \\ 3.798 \end{pmatrix}$
You can assign to a sub-vector within a vector:
[> us[4..] := Vector( 3 );
$us_{4..-1} := \begin{pmatrix} 0 \\ 0 \\ 0 \end{pmatrix}$
[> us;
$\begin{pmatrix} 3.326 \\ 3.543 \\ 3.759 \\ 0 \\ 0 \\ 0 \end{pmatrix}$
You can also provide a list, which will extract the specified entries in that order, including duplication:
[> us[[1,6,2,5]];
$\begin{pmatrix} 3.326 \\ 0 \\ 3.543 \\ 0 \end{pmatrix}$
[> us[[2..5, 1, 6, 1, 6]];
$\begin{pmatrix} 3.543 \\ 3.759 \\ 0 \\ 0 \\ 3.326 \\ 0 \\ 3.326 \\ 0 \end{pmatrix}$
Thus, a vector can be indexed by:
Note: You will note that the above are what are colloquially described as column vectors. Maple also allows for row vectors, but these tend not to be useful with respect to engineering applications of linear algebra. Instead, when the occasion calls for it, we may take the transpose of a column vector. Henceforth, we will simply describe column vectors as vectors.
Maple explicitly differentiates between scalars, vectors and matrices, but for Matlab, you may have noticed that scalars, are $1 \times 1$ matrices, vectors are actually $n \times 1$ matrices or $1 \times n$ matrices, and all of these are matrices. Thus, if you were to multipliy a $1 \times n$ vector in Matlab by an $n \times 1$ vector, you get something that looks like a scalar, but it is actually a $1 \times 1$ matrix. Its a question of interpretation: if you multiply a $1 \times 1$ matrix by an $m \times n$ matrix, then rather than throwing an error, it assumes the first is a scalar and performs scalar multiplication on the matrix.
In Maple, if you multiply a $1 \times n$ matrix by an $n \times 1$ matrix, you get a $1 \times 1$ matrix, and it is not a scalar.