Algebra with Matrices, Vectors, and Arrays
|
Expressions involving sums, products, and powers with rtable objects are evaluated directly. An rtable object is either an Array, Matrix, or Vector.
|
|
Description
|
|
•
|
The result that is returned for a particular expression is described below. In each of the following sections:
|
|
- c is a numeric constant
|
|
- s is a non-numeric scalar
|
|
|
Sums
|
|
|
The result that is returned when an expression of type '+' includes at least one rtable depends on the operands.
|
Expression
|
Result
|
|
|
|
The component-wise sum of and ,
|
|
if the dimensions match;
|
|
otherwise, returns an error
|
|
Adds to every element of
|
|
Returns unevaluated
|
|
|
|
The component-wise sum of and ,
|
|
if the dimensions match;
|
|
otherwise, returns an error
|
|
Adds to the main diagonal of
|
|
Returns unevaluated
|
|
|
|
The component-wise sum of and ,
|
|
if dimensions and orientations match;
|
|
otherwise, returns an error
|
|
An error
|
|
Returns unevaluated
|
|
|
other
|
All other combinations raise errors
|
|
|
|
Direct evaluation of these expressions is implemented by calls to the rtable/Sum library routine.
|
|
|
Products
|
|
|
The result that is returned when an expression of type '*' includes at least one rtable depends on the operands. If the operands are either Matrices, Vectors or a combination of each (with appropriate dimensions), the '.' operator must be used. For more information, see dot.
|
Expression
|
Result
|
|
|
|
The component-wise product of and , if the dimensions match;
|
|
otherwise, returns an error
|
|
Multiplies every element of by
|
|
Returns unevaluated
|
|
|
|
An error (must use the '.' (dot) operator)
|
|
Multiplies every element of by
|
|
Returns unevaluated
|
|
|
|
An error (must use the '.' (dot) operator)
|
|
Multiplies every element of by
|
|
Returns unevaluated
|
|
|
other
|
All other combinations raise errors
|
|
|
|
Direct evaluation of these expressions is implemented by calls to the rtable/Product library routine.
|
|
|
Powers
|
|
|
The result that is returned when an expression of type '^' includes an rtable object base depends on the exponent type.
|
|
Otherwise, the following interpretations of a power of an rtable apply.
|
Expression
|
Result
|
|
|
|
The component-wise exponentiation of .
|
|
Constant c can be any (complex) numeric value.
|
|
Returns unevaluated
|
|
|
|
If M is square and c is a positive integer, then
|
|
the result is the matrix product ...
|
|
(c factors using the dot operator)
|
|
If c is a negative integer, the result is
|
|
( ... ) ( factors using
|
|
the dot operator)
|
|
If , the result is
|
|
If is not an integer, it returns unevaluated
|
|
Returns unevaluated
|
|
|
|
Direct evaluation of these expressions is implemented by calls to the rtable/Power library routine.
|
|
|
Examples
|
|
>
|
|
| (1) |
>
|
|
| (2) |
>
|
|
| (3) |
>
|
|
| (4) |
>
|
|
| (5) |
>
|
|
| (6) |
>
|
|
| (7) |
>
|
|
| (8) |
>
|
|
| (9) |
>
|
|
| (10) |
>
|
|
| (11) |
>
|
|
| (12) |
>
|
|
| (13) |
>
|
|
| (14) |
The * operator cannot be used to multiply Matrices or Vectors.
>
|
|
>
|
|
| (15) |
>
|
|
| (16) |
Note the difference between * and . when one operand is a symbolic scalar.
>
|
|
| (17) |
>
|
|
| (18) |
>
|
|
| (19) |
>
|
|
| (20) |
>
|
|
| (21) |
>
|
|
| (22) |
>
|
|
| (23) |
>
|
|
| (24) |
>
|
|
| (25) |
>
|
|
| (26) |
|
|