
dot([1 2],[3 4]} returns 11
L
2
Norm
Returns the l
2
norm (sqrt(x1^2+x2^2+...xn^2)) of a vector.
l2norm(Vect)
Example:
l2norm([3 4 -2]) returns √29
L
1
Norm
Returns the l
1
norm (sum of the absolute values of the coordinates) of a vector.
l1norm(Vect)
Example:
l1norm([3 4 -2]) returns 9
Max Norm
Returns the l∞ norm (the maximum of the absolute values of the coordinates) of a vector.
maxnorm(Vect or Mtrx)
Example:
maxnorm([1 2 3 -4]) returns 4
Examples
Identity Matrix
You can create an identity matrix with the IDENMAT function. For example, IDENMAT(2) creates the 2×2
identity matrix [[1,0],[0,1]].
You can also create an identity matrix using the MAKEMAT (make matrix) function. For example, entering
MAKEMAT(I ≠J,4,4) creates a 4 × 4 matrix showing the numeral 1 for all elements except zeros on the
diagonal. The logical operator (≠) returns 0 when I (the row number) and J (the column number) are equal, and
returns 1 when they are not equal. (You can insert ≠ by choosing it from the relations palette:
.)
Transposing a Matrix
The TRN function swaps the row–column and column–row elements of a matrix. For instance, element 1,2
(row 1, column 2) is swapped with element 2,1; element 2,3 is swapped with element 3,2; and so on.
For example, TRN([[1,2],[3,4]]) creates the matrix [[1,3],[2,4]].
Matrix functions 541
Komentarze do niniejszej Instrukcji