use dot for multiplication of vectors and matrices - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.

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

A⋅b

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

A≔a__11a__12a__21a__22

(2.1)
> 

v ≔ v__1v__2

v≔v__1v__2

(2.2)
> 

A⋅A

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

> 

A⋅v

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;

W≔abcd

(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