invalid arguments (in rtable Product) - Maple Help

Home : Support : Online Help : System : Error Message Guide : invalid arguments (in rtable Product)

Error, (in rtable/Product) invalid arguments

 Description For users of Maple 18 and earlier versions: This error is caused when the asterisk (*) is used for multiplying together Matrices or Vectors. Only a dot (period, or .) should be used in this case.   When you type an asterisk while in 2-D Math mode, this is displayed as a center dot $\left(\cdot \right)$ representing the commutative multiplication operator. In contrast, when you type the period, this is displayed as a lower dot $\left(.\right)$ representing the dot operator, used for non-commutative or dot-product multiplication. The center dot is intended for scalar multiplication (including scalars multiplied with Vectors and Matrices), but not for non-commutative or dot-product multiplication. This is why the dot operator is needed for multiplying Vectors or Matrices together.   2-D Math is used throughout this help page (unless otherwise noted) so that examples using implicit multiplication (a space) can be shown.

Examples

Example 1

 >
 ${M}{:=}\left[\begin{array}{rr}{1}& {3}\\ {2}& {4}\end{array}\right]$ (2.1)
 >
 ${V}{:=}\left[\begin{array}{r}{5}\\ {6}\end{array}\right]$ (2.2)
 > $M\cdot V$

In this first example, M and V are assigned to a Matrix and Vector. When multiplication is attempted using the center dot, an error is returned. Here is the equivalent example using 1-D Maple Input (which shows the underlying Maple syntax):

 > M*V;

Solution:

To fix the problem, the dot operator (period) should be used instead of the center dot (asterisk):

 > $M.V$
 $\left[\begin{array}{r}{23}\\ {34}\end{array}\right]$ (2.3)

Here is the same solution using 1-D Maple Input:

 > M.V;
 $\left[\begin{array}{r}{23}\\ {34}\end{array}\right]$ (2.4)

Example 2

 >
 > $f\left(M,V\right)$

Since Maple does not know that $a$ and $b$ are Matrices when the procedure is defined, it inserts the commutative multiplication operator (asterisk) internally where the space has been used for implicit multiplication. When $a$ and $b$ are then defined as Matrices, it returns an error because this operator cannot be used for multiplication of Matrices together.

Solution:

Use the dot operator to perform explicit multiplication. Here is a similar procedure that returns the expected result:

 >
 > $g\left(M,V\right)$
 $\left[\begin{array}{r}{23}\\ {34}\end{array}\right]$ (2.5)

Note that implicit multiplication does work for Matrices and Vectors outside a procedure or operator body. In the following examples, $M$ and $V$ are already defined as Matrices, so Maple correctly interprets the space to perform implicit multiplication of the Matrices together.

 >
 $\left[\begin{array}{rr}{7}& {15}\\ {10}& {22}\end{array}\right]$ (2.6)
 >
 $\left[\begin{array}{r}{23}\\ {34}\end{array}\right]$ (2.7)

This is why it is common for people to attempt implicit multiplication inside a procedure. However, as can be seen in Example 2, those attempts fail and return an error.

Example 3

 > $f≔\left(A,B\right)\to A+B:$
 > $g≔\left(M,N\right)\to M-N:$
 >

Implicit multiplication should always work if the items are already Matrices or Vectors. Outside of a procedure body, implicit multiplication will fail when multiplying together function calls that are intended to return Matrices and Vectors but which have not yet been computed. In this example, the 2-D Math parser did not know what type of objects the $f$ and $g$ function calls would return.

Solution:

Again, use the dot operator to perform explicit multiplication.

 > $f\left(⟨2,3⟩,⟨7,11⟩\right).g\left(⟨1,1⟩,⟨1,-1⟩\right)$
 ${28}$ (2.8)