MatrixScalarMultiply - Maple Help

LinearAlgebra

 ScalarMultiply
 compute the product of a Matrix or Vector and a scalar
 MatrixScalarMultiply
 compute the product of a Matrix and a scalar
 VectorScalarMultiply
 compute the product of a Vector and a scalar

 Calling Sequence ScalarMultiply(A, s, ip, options) MatrixScalarMultiply(A, s, ip, options) VectorScalarMultiply(A, s, ip, options)

Parameters

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

Description

 • The ScalarMultiply(A, s) function computes the product $As$.
 • If A is an n x m Matrix and B := ScalarMultiply(A, s), then B[i, j]=A[i, j]*s for i=1..n and j=1..m.
 If A is a Matrix, the ScalarMultiply(A, s) function is equivalent to the MatrixScalarMultiply(A, s) function.
 • If A is an n-dimensional Vector and B := ScalarMultiply(A, s), then ${B}_{i}={A}_{i}s$ for i=1..n.
 If A is a Vector, the ScalarMultiply(A, s) function is equivalent to the VectorScalarMultiply(A, s) function.
 • 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).
 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 ScalarMultiply(..) only after executing the command with(LinearAlgebra). However, it can always be accessed through the long form of the command by using LinearAlgebra[ScalarMultiply](..).
 • These functions have an equivalent shortcut notation, A.s (with the exception that any expression which is of type algebraic and not of type rtable is treated as a scalar, while the dot operator only considers objects of type constant to be scalars).  For more information, see the dot operator.

Examples

 > $\mathrm{with}\left(\mathrm{LinearAlgebra}\right):$
 > $A≔⟨⟨\mathrm{sx},0,0⟩|⟨0,\mathrm{sy},0⟩|⟨0,0,1⟩⟩$
 ${A}{≔}\left[\begin{array}{ccc}{\mathrm{sx}}& {0}& {0}\\ {0}& {\mathrm{sy}}& {0}\\ {0}& {0}& {1}\end{array}\right]$ (1)
 > $\mathrm{ScalarMultiply}\left(A,2\right)$
 $\left[\begin{array}{ccc}{2}{}{\mathrm{sx}}& {0}& {0}\\ {0}& {2}{}{\mathrm{sy}}& {0}\\ {0}& {0}& {2}\end{array}\right]$ (2)
 > $\mathrm{MatrixScalarMultiply}\left(\mathrm{IdentityMatrix}\left(2\right),a\right)$
 $\left[\begin{array}{cc}{a}& {0}\\ {0}& {a}\end{array}\right]$ (3)
 > $v≔⟨\mathrm{\alpha }|\mathrm{\beta }|0⟩$
 ${v}{≔}\left[\begin{array}{ccc}{\mathrm{\alpha }}& {\mathrm{\beta }}& {0}\end{array}\right]$ (4)
 > $\mathrm{VectorScalarMultiply}\left(v,\frac{1}{2}\right)$
 $\left[\begin{array}{ccc}\frac{{\mathrm{\alpha }}}{{2}}& \frac{{\mathrm{\beta }}}{{2}}& {0}\end{array}\right]$ (5)