Algebra with Matrices, Vectors, and Arrays - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Data Types : Rtables, Arrays, Matrices, and Vectors : rtable_algebra

Algebra with Matrices, Vectors, and Arrays

  

Expressions involving sums, products, and powers with rtable objects are evaluated directly. An rtable object is either an Array, Matrix, or Vector.

 

Description

Sums

Products

Powers

Examples

Description

• 

The result that is returned for a particular expression is described below. In each of the following sections:

  

- A is an Array

  

- M is a Matrix

  

- V is a Vector

  

- c is a numeric constant

  

- s is a non-numeric scalar

Sums

  

The result that is returned when an expression of type '+' includes at least one rtable depends on the operands.

  

 

     Expression

Result

 

 

     A1+A2

The component-wise sum of A1 and A2,

 

if the dimensions match;

 

otherwise, returns an error

     A+c

Adds c to every element of A

     A+s

Returns unevaluated

 

 

     M1+M2

The component-wise sum of M1 and M2,

 

if the dimensions match;

 

otherwise, returns an error

     M+c

Adds c to the main diagonal of M

     M+s

Returns unevaluated

 

 

     V1+V2

The component-wise sum of V1 and V2,

 

if dimensions and orientations match;

 

otherwise, returns an error

     V+c

An error

     V+s

Returns unevaluated

 

 

     other

All other combinations raise errors

  

Direct evaluation of these expressions is implemented by calls to the rtable/Sum library routine.

Products

  

The result that is returned when an expression of type '*' includes at least one rtable depends on the operands. If the operands are either Matrices, Vectors or a combination of each (with appropriate dimensions), the '.' operator must be used. For more information, see dot.

  

 

     Expression

Result

 

 

     A1A2

The component-wise product of A1 and A2, if the dimensions match;

 

otherwise, returns an error

     cA

Multiplies every element of A by c

     sA

Returns unevaluated

 

 

     M1M2

An error (must use the '.' (dot) operator)

     cM

Multiplies every element of M by c

     sM

Returns unevaluated

 

 

     V1V2

An error (must use the '.' (dot) operator)

     cV

Multiplies every element of V by c

     sV

Returns unevaluated

 

 

     other

All other combinations raise errors

  

Direct evaluation of these expressions is implemented by calls to the rtable/Product library routine.

Powers

  

The result that is returned when an expression of type '^' includes an rtable object base depends on the exponent type.

  

There are two cases in which the exponent is interpreted specially: R+=LinearAlgebra:TransposeR and R*=LinearAlgebra:HermitianTransposeR.  (The deprecated notations, R%T and R%H, respectively, are similarly interpreted.)

  

Otherwise, the following interpretations of a power of an rtable apply.

    Expression

Result

 

 

     Ac

The component-wise exponentiation of A.

 

Constant c can be any (complex) numeric value.

     As

Returns unevaluated

 

 

     Mc

If M is square and c is a positive integer, then

 

the result is the matrix product M.M.M ... M

 

(c factors using the dot operator)

 

If c is a negative integer, the result is

 

MatrixInverse( M.M.M ... M) (c factors using

 

the dot operator)

 

If c=0, the result is 1

 

If c is not an integer, it returns unevaluated

     Ms

Returns unevaluated

  

 

  

Direct evaluation of these expressions is implemented by calls to the rtable/Power library routine.

Examples

c2

c:=2

(1)

A1Array1,2,3,4

A1:=1234

(2)

A2Arrayu,v,w,x

A2:=uvwx

(3)

M11,2|2,1

M1:=1221

(4)

M22,3|4,4

M2:=2434

(5)

V1x|y

V1:=xy

(6)

A1+A2

1+u2+v3+w4+x

(7)

A1+c

3456

(8)

A1+s

s+1234

(9)

M1+M2

3255

(10)

M1+c

3223

(11)

M1+s

s+1221

(12)

A1A2

u2v3w4x

(13)

A1.A2

u2v3w4x

(14)

The * operator cannot be used to multiply Matrices or Vectors.

M1M2

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

cM1

2442

(15)

c.M1

2442

(16)

Note the difference between * and . when one operand is a symbolic scalar.

sM1

s2s2ss

(17)

s.M1

s.1221

(18)

M1.M2

44712

(19)

V1.M2

2x+3y4x+4y

(20)

A1c

14916

(21)

A1s

12s3s4s

(22)

M2c

16241828

(23)

M2s

2434s

(24)

M2%T

2344

(25)

V1%H

x&conjugate0;y&conjugate0;

(26)

See Also

Array

dot

LinearAlgebra[Transpose]

Matrix

rtable

Vector

 


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam