use dot for multiplication of vectors and matrices - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.
Our website is currently undergoing maintenance, which may result in occasional errors while browsing. We apologize for any inconvenience this may cause and are working swiftly to restore full functionality. Thank you for your patience.

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : System : Error Message Guide : use dot for multiplication of vectors and matrices

Error, (in rtable/Product) use *~ for elementwise multiplication of Vectors or Matrices; use . (dot) for Vector/Matrix multiplication

 

Description

Examples

Description

An expression involving the multiplication of Vectors and/or Matrices (possibly and/or Arrays) has been constructed using the standard multiplication operator, `*`, which is ambiguous.

 

Note that in 2-D math `*` displays as a center dot: `⋅`, and typing a dot (using the period key) displays as `·`, as show in the following table.

When you type

It displays as

A*b

Ab

A.b

A·b

This display can be modified through the interactive Typesetting Rule Assistant.

 

For Vector/Matrix multiplication, use . (dot).  If instead you want to perform elementwise multiplication, use *~.

Examples

 Example 1:

This error results if Matrices, or a Matrix and a Vector, are multiplied using a commutative multiplication operator, `*`:

A  a__11a__12a__21a__22

Aa__11a__12a__21a__22

(2.1)

v  v__1v__2

vv__1v__2

(2.2)

AA

Error, (in rtable/Product) use *~ for elementwise multiplication of Vectors or Matrices; use . (dot) for Vector/Matrix multiplication

Av

Error, (in rtable/Product) use *~ for elementwise multiplication of Vectors or Matrices; use . (dot) for Vector/Matrix multiplication

 

Solution 1:

To multiply Matrices and/or Vectors together using the standard Linear Algebra multiplication operation, use the non-commutative multiplication operator, `.` (dot):

A·A

A·v

Example 2:

Implicit multiplication (using a space to mean multiplication) can also be ambiguous.

W  Array1..2,1..2,a,b,c,d;

Wabcd

(2.3)

A W

Error, (in rtable/Product) use *~ for elementwise multiplication of Vectors or Matrices; use . (dot) for Vector/Matrix multiplication

 

Solution 2:

To multiply Vectors and/or Matrices and/or Arrays together using elementwise multiplication, use the standard multiplication operator, `*` followed by the "elementwise" operator, `~`:

A ~ A

A ~ W

Note that when multiplying Arrays together (not with Vectors or Matrices), the standard multiplication operator will result in the elementwise product, so the `~` is not necessary:

W  W

a2b2c2d2

(2.4)

Note also that implicit multiplication is interpreted based on the operands, and when it can, Maple parses these as follows: For Vector/Matrix operands this will be interpreted as the `.` (dot) non-commutative multiplication operator, while for Array operands this will be interpreted as the elementwise operator:

A v

W W

However, best practice is to insert the explicit multiplication operator into your expressions.

See Also

Array

binary operators

dot

LinearAlgebra

Matrix

Vector