Theme 9. Matrix operations in Maple. Systems of linear equations

3. LinearAlgebra package matrix operations

The LinearAlgebra package is new and allows you to work with large matrices using approximate calculations from the Numerical Algoritms Group ( NAG ). and in the LinearAlgebra package - on the basis of special Vector () and Matrix () constructors or a short notation <a, b, c> ..

 

Teams of work with the structure of matrices and vectors:

  • rowdim (M) is the number of rows in the matrix M.
  • coldim (M) The number of columns of matrix M.
  • vectdim (v) number of vector elements v.
  • convert (list, vector) transforms the variable type list into a vector.
  • row (M, i) of the selection of a-line from the matrix M.
  • col (M, i) selection of the i-th column from matrix M.
  • CONCAT (M1, M2) M1 and M2 matrices.

Mathematical operations with matrices and vectors:

  • add (u, v) or evalm (u + v) adding two vectors or matrices.
  • multiply (M1, M2) or evalm (M1 & * M2) the multiplication of matrices M1 and M2.
  • dotprod (v1, v2) is the scalar product of vectors v1 and v2.
  • crossprod (v1, v2) vector product of vectors v1 and v2.
  • angle (v1, v2) calculates the angle between the vectors v1 and v2 of the same length.
  • inverse (M) or computation of the inverse to the M matrix.
  • det (M) calculating the determinant of the matrix.
  • transpose (M) transposition of the matrix.
  • linsolve (M, v) solution of the linear system of equations Mx = v.
  • gausselim (M) Gauss method for matrix M.

Examples

Matrix task:

with (linalg):

A: = matrix (3.3, [1,4,2,2,1, -2,1,1, -1]); B: = matrix ([[4.6, -2], [6.10, -1], [2,4, -5]]);

Calculating the square of the matrix A (the product of the matrix A itself): evalm (A & * A);

The product of the matrix A on the matrix B : multiply (A, B);

Transposition of the matrix A : transpose (A);

The solution of the system of linear equations in Maple

with (linalg);

eqns: = {x + 5y-z = 1, x + y = 5, x + z = 7}; # setting the system of linear equations

benchmark: = solve (eqns); # system solution

{x = -17/7, y = 18/7, z = 66/7}

subs (bench, eqns); # Checking the solution by substitution in the system - we obtain identities

{7 = 7,5 = 5,1 = 1}

linsolve (A, B); # solution of the system of equations A X = B, where A is a matrix, B is a column of free members

Accessibility

Font Face Font Face

Font Size Font Size

1

Text Colour Text Colour

Background Colour Background Colour

Font Kerning Font Kerning

Image Visibility Image Visibility

Letter Spacing Letter Spacing

0

Line Height Line Height

1.2

Link Highlight Link Highlight