Multiply - Maple Help

LinearAlgebra

 Multiply
 compute the product of Matrices, Vectors, and scalars

 Calling Sequence Multiply(A, B, ip, outopt)

Parameters

 A - Matrix, Vector, or scalar B - Matrix, Vector, or scalar ip - (optional) equation of the form inplace=true or false; specifies if output overwrites input outopt - (optional); constructor options for the result object

Description

 • The Multiply(A, B) function computes the product $A·B$. The type of result that is returned depends on the type of A and B (see the table under Programming Note below).
 • The inplace option (ip) determines where the result is returned. If given as inplace=true, the result overwrites the first argument. If given as inplace=false, or if this option is not included in the calling sequence, the result is returned in a new Matrix (or Vector).
 If the first argument is a scalar, the computation is performed in place on the second argument (if possible). If both arguments are scalars, the inplace and constructor options parameters are ignored.
 The condition inplace=true can be abbreviated to inplace.
 The inplace option must be used with caution since, if the operation fails, the original Matrix (or Vector) argument may be corrupted.
 • The constructor options provide additional information (readonly, shape, storage, order, datatype, and attributes) to the Matrix or Vector constructor that builds the result. These options may also be provided in the form outputoptions=[...], where [...] represents a Maple list.  If a constructor option is provided in both the calling sequence directly and in an outputoptions option, the latter takes precedence (regardless of the order).
 • The inplace and constructor options are mutually exclusive.
 • This function is part of the LinearAlgebra package, and so it can be used in the form Multiply(..) only after executing the command with(LinearAlgebra). However, it can always be accessed through the long form of the command by using LinearAlgebra[Multiply](..).
 • This function has an equivalent shortcut notation, A.B (with the exception that LinearAlgebra[Multiply] treats any expression which is of type algebraic and not of type rtable as a scalar, while the dot operator only considers objects of type constant to be scalars).  For more information, see the dot operator.
 Programming Note
 This routine uses the types of A and B to choose the corresponding binary multiplication routine in the LinearAlgebra package. The parameter types, the corresponding result type, and the LinearAlgebra multiplication routine that is called are shown in the following table.

 B A qXn 1Xn qX1 Matrix row Vector col Vector scalar mXq mXn Matrix ERROR mX1 col Vector mXq Matrix Matrix 1Xq 1Xn row Vector ERROR scalar 1Xq Vector row Vector mX1 ERROR mXn Matrix (outer product) ERROR mX1  Vector col Vector qXn Matrix 1Xn row Vector qX1 col Vector scalar scalar standard multiplication

 Notes:
 *  If either A or B are unrecognized types (not a Matrix, Vector, or scalar), an error is returned.
 *  In the outer product case, the result is not constructed as a Matrix with the OuterProduct shape, but rather it is generated as a full rectangular Matrix.

Examples

 > $\mathrm{with}\left(\mathrm{LinearAlgebra}\right):$
 > $A≔⟨⟨n,0⟩|⟨0,n⟩⟩$
 ${A}{≔}\left[\begin{array}{cc}{n}& {0}\\ {0}& {n}\end{array}\right]$ (1)
 > $\mathrm{Multiply}\left(A,A\right)$
 $\left[\begin{array}{cc}{{n}}^{{2}}& {0}\\ {0}& {{n}}^{{2}}\end{array}\right]$ (2)
 > $\mathrm{Multiply}\left(A,-2,\mathrm{inplace}\right)$
 $\left[\begin{array}{cc}{-}{2}{}{n}& {0}\\ {0}& {-}{2}{}{n}\end{array}\right]$ (3)
 > $A$
 $\left[\begin{array}{cc}{-}{2}{}{n}& {0}\\ {0}& {-}{2}{}{n}\end{array}\right]$ (4)
 > $\mathrm{r1}≔⟨3|2|1⟩$
 ${\mathrm{r1}}{≔}\left[\begin{array}{ccc}{3}& {2}& {1}\end{array}\right]$ (5)
 > $\mathrm{c1}≔⟨x,y,z⟩$
 ${\mathrm{c1}}{≔}\left[\begin{array}{c}{x}\\ {y}\\ {z}\end{array}\right]$ (6)
 > $\mathrm{Multiply}\left(\mathrm{r1},\mathrm{c1}\right)$
 ${3}{}{x}{+}{2}{}{y}{+}{z}$ (7)
 > $B≔\mathrm{Multiply}\left(\mathrm{c1},\mathrm{r1}\right)$
 ${B}{≔}\left[\begin{array}{ccc}{3}{}{x}& {2}{}{x}& {x}\\ {3}{}{y}& {2}{}{y}& {y}\\ {3}{}{z}& {2}{}{z}& {z}\end{array}\right]$ (8)
 > $\mathrm{Multiply}\left(B,⟨0,0,1⟩\right)$
 $\left[\begin{array}{c}{x}\\ {y}\\ {z}\end{array}\right]$ (9)