Vector Operations
In Derive a matrix is just a vector of vectors. Therefore, the vector operations described in this section also apply to matrices.
Use ABS to compute the magnitude (length) of a vector. The absolute value of a vector is the square root of the sum of the squares of its elements. For example,
ABS([a, b, c])
simplifies to the square-root of a²+b²+c². When applied to a matrix, ABS computes the Frobenius norm of the matrix.
Use the plus operator, +, to add the corresponding elements of vectors and matrices. Vectors must have the same number of elements, and matrices must have the same number of rows and columns. Enter the plus operator by clicking on the + on the math symbol toolbar or by typing + on the keyboard. For example,
[a, b, c] + [d, e, f]
simplifies to
[a + d, b + e, c + f]
Use the minus operator, −, to subtract the corresponding elements of vectors or matrices. Vectors must have the same number of elements, and matrices must have the same number of rows and columns. Enter the minus operator by clicking on the − on the math symbol toolbar or by typing − on the keyboard. For example,
[a, b, c] - [d, e, f]
simplifies to
[a - d, b - e, c - f]
Use the times operator, ·, or implicit multiplication to multiply each element of a vector or matrix by a scalar. Enter the times operator by clicking on the · on the math symbol toolbar or by typing * on the keyboard. For example,
3·[a, b, c]
simplifies to
[3·a, 3·b, 3·c]
Use the quotient operator, /, to divide each element of a vector or matrix by a scalar. Enter the quotient operator by clicking on the / on the math symbol toolbar or by typing / on the keyboard. For example,
[a, b, c]/3
simplifies to
⎡ a b c ⎤
⎢———, ———, ———⎥
⎣ 3 3 3 ⎦
Use the times operator or implicit multiplication to compute the sum of the products of corresponding elements of the two vectors. (Use the dot and cross product operators discussed below to compute the dot and cross products of vectors.) Note that the vectors must have the same number of elements, and that the result is a scalar. For example,
[a, b, c]·[d, e, f]
simplifies to
a·d + b·e + c·f
Use the exponentiation operator, ^, to raise vectors to powers. If n is a positive integer and v is a vector, v^n simplifies to the product v·v^(n-1). If n is a negative integer, v^n simplifies to (v/(v·v))^-n. For example,
[a, b, c]^(-2)
simplifies to
1
——————————————
2 2 2
a + b + c
The product of a matrix and a vector, in that order, is the vector whose elements are the product of the vector and the rows of the matrix. Thus the number of elements of the vector must equal the number of columns of the matrix. For example,
[a, b; c, d]·[2, 3]
displays as
⎡ a b ⎤
⎢ ⎥·[2, 3]
⎣ c d ⎦
and simplifies to
[2·a + 3·b, 2·c + 3·d]
The product of a vector and a matrix, in that order, is the vector whose elements are the product of the vector and the columns of the matrix. Thus the number of elements of the vector must equal the number of rows of the matrix. For example,
[2, 3]·[a, b; c, d]
displays as
⎡ a b ⎤
[2, 3]·⎢ ⎥
⎣ c d ⎦
and simplifies to
[2·a + 3·c, 2·b + 3·d]
The product of two matrices is the matrix whose elements are the product of the rows of the first matrix and the columns of the second matrix. Thus the number of columns of the first matrix must equal the number of rows of the second matrix. For example,
[a, b; c, d]·[2; 3]
displays as
⎡ a b ⎤ ⎡ 2 ⎤
⎢ ⎥·⎢ ⎥
⎣ c d ⎦ ⎣ 3 ⎦
and simplifies to
⎡ 2·a + 3·b ⎤
⎢ ⎥
⎣ 2·c + 3·d ⎦
As another, more general, example,
[2, 3; 4, 5]·[a, b, c; d, e, f]
displays as
⎡ 2 3 ⎤ ⎡ a b c ⎤
⎢ ⎥·⎢ ⎥
⎣ 4 5 ⎦ ⎣ d e f ⎦
and simplifies to
⎡ 2·a + 3·d 2·b + 3·e 2·c + 3·f ⎤
⎢ ⎥
⎣ 4·a + 5·d 4·b + 5·e 4·c + 5·f ⎦
If variables are being used to represent vectors or matrices, declare them to be of vector type using the Author > Variable Domain command8MNT4Y so their products will not be re-ordered or re-associated.
Use the dot product operator, •, to compute the dot product (also called the inner product or scalar product) of two vectors. Enter the dot operator by clicking on the • on the math symbol toolbar or by typing DOTPRODUCT on the keyboard. The dot product of two vectors is the sum of the products of the elements of the first vector times the complex conjugate of the corresponding elements of the second vector. Note that the vectors must have the same number of elements, and that the result is a scalar. For example,
[a + b·#i, c + d·#i] DOTPRODUCT [e + f·#i, g + h·#i]
simplifies to
a·e + b·f + c·g + d·h - #i·(a·f - b·e + c·h - d·g)
and in particular,
[a + b·#i, c + d·#i] DOTPRODUCT [a + b·#i, c + d·#i]
simplifies to
2 2 2 2
a + b + c + d
Use the cross product operator, ×, to compute the cross product (also called the vector product) of two vectors. Enter the cross product operator by clicking on the × on the math symbol toolbar or by typing CROSSPRODUCT on the keyboard. Note that both vectors must have three elements or both must have two elements. Three element cross products result in a vector; whereas, two element cross products result in a scalar. For example,
[a, b, c] CROSSPRODUCT [d, e, f]
simplifies to
[b·f - c·e, c·d - a·f, a·e - b·d]
and
[a, b] CROSSPRODUCT [c, d]
simplifies to
a·d - b·c
Use the OUTER function defined in the VectorMatrixFunctions.mthI._DEZ utility file to compute outer products.
Other Vectors and MatricesVectors_and_Matrices topics
Created with the Personal Edition of HelpNDoc: Free EPub producer