Linear Algebra Computations in Maple In the study of linear algebra, the computations are as important as the concepts. Maple can perform these computations, but you have to choose the methods and know how to interpret the results. Maple offers two choices for performing calculations in linear algebra: the linalg package and the LinearAlgebra package. The linalg package is deprecated, and use of the LinearAlgebra package is recommended. The following sections give more information on these packages and outline their differences. Note: The documentation regarding these packages uses the convention that matrix (lowercase "m") refers to an array-based matrix used by routines in the linalg package, and Matrix (uppercase "M") refers to an rtable-based Matrix used by routines in the LinearAlgebra package. The convention is similar for vectors and Vectors. About the linalg PackageAbout the LinearAlgebra PackageChoosing Between the linalg and the LinearAlgebra PackageConverting Between linalg and LinearAlgebra
<Text-field style="Heading 2" layout="Heading 2" bookmark="bkmrk0">About the linalg Package</Text-field> The linalg package is a set of procedures which represent over 100 commands that enable you to perform numerous types of calculations in linear algebra. This package is characterized by the following features. Arrays as Basic Data Structures The fundamental data structure used by the routines in this package is the array. Arrays are created by using the array(..) command. There are commands to create both vectors and matrices; however, these are just special cases of the array(..) command. There are no predefined commands in this package for special types of matrices (such as identity and zero); they must also be defined by using the array(..) command. Last Name Evaluation Expressions containing arrays are evaluated by using "last name evaluation" -- if an array is assigned to a variable name and that name is entered on another command line, the result displayed is not the array itself, but the variable name to which it is assigned. To display an array that has been assigned to a variable, you must use the eval(..) or the print(..) command. Special Evaluation Command for Matrix Algebra The linalg package includes many commands to perform matrix algebra. However, when using shortcut notation for performing matrix algebra, matrix expressions such as A+B remain unevaluated unless used as a parameter to the evalm(..) command. In particular, shorthand matrix multiplication requires both the evalm(..) command and the special matrix multiplication operator, &*. Abstract Linear Algebra Performing computations in abstract linear algebra is possible through the use of inert operators and the evalm(..) command. Limited Ability to Compute using Large Matrices with Numeric Elements For computational linear algebra, the linalg package permits both numeric and symbolic entries in a matrix. However, the ability to perform computations on very large matrices with numeric entries, by using commands from this package, is limited.
<Text-field style="Heading 2" layout="Heading 2" bookmark="bkmrk1">About the LinearAlgebra Package</Text-field> The LinearAlgebra package is a group of linear algebra commands that contains nearly all of the functionality of the linalg package, but also has well-defined data structures, additional commands for creating special types of Matrices, and improved Matrix algebra. Also, especially when calculating with large numeric Matrices, it is much more powerful and efficient. Vectors and Matrices as Basic Data Structures The fundamental data structures used by routines in the LinearAlgebra package are Vectors and Matrices. They are created by using the Vector(..) and Matrix(..) commands, respectively, or by using the available shortcut notation (<a, b, c>). Their implementation is based on Maple's rtable data structure. As a result, lists, table-based and rtable-based arrays, linalg matrices, and linalg vectors are not interchangeable with Vectors and Matrices. Commands for Special Matrix and Vector Types Included in the LinearAlgebra package are commands to construct special Matrices and Vectors (such as zero, identity, and constant). Direct Evaluation in Matrix Algebra The LinearAlgebra package includes many commands to perform Matrix algebra. In addition, Matrix algebra expressions such as A+B, A.B, and A-A are evaluated directly. This significantly reduces the need to learn additional commands and syntax. Module Implementation for Control over Names Since the set of LinearAlgebra routines is implemented as a module, an environment is created where the short form of the names of these commands can be made available by using the with(..) command. Efficient Computations with Large Numeric Matrices Maple's alliance with the Numerical Algorithms Group (NAG) has resulted in the incorporation of additional numerical algorithms in Maple, for use by the LinearAlgebra package. Additionally, the LinearAlgebra command calling sequences can be used in a standard format or by including options that specify certain Matrix properties. Including these options in the calling sequence aids Maple's algorithm selection for computation. As a result, the efficiency of computations on large Matrices with numeric entries is greatly improved.
<Text-field style="Heading 2" layout="Heading 2" bookmark="bkmrk2">Choosing Between the linalg and the LinearAlgebra Package</Text-field> To determine which implementation of Maple's linear algebra commands to use, consider the following synopsis. The linalg package is useful for doing computations in abstract linear algebra. Compared to the linalg package, the LinearAlgebra package includes several special Matrix constructor commands, is more user-friendly in Matrix algebra calculations, and is more powerful and efficient in doing linear algebra calculations, especially when working with large numeric Matrices.
<Text-field style="Heading 2" layout="Heading 2" bookmark="bkmrk3">Converting Between linalg and LinearAlgebra</Text-field> The linalg package uses matrix and vector types (table-based array data structures). The LinearAlgebra package uses Matrix and Vector types (rtable-based data structures). To convert between the two implementations of vector and matrix objects, use one of the following methods. Conversion from Matrix to matrix A LinearAlgebra Matrix can be converted to a linalg matrix by using the convert(.., matrix) command. Similarly, a LinearAlgebra Vector can be converted to a linalg vector by using the convert(.., vector) command. Conversion from matrix to Matrix A linalg matrix can be converted to a LinearAlgebra Matrix by using the convert(.., Matrix) command. Similarly, a linalg vector can be converted to a LinearAlgebra Vector by using the convert(.., Vector) command. Alternatively, the Matrix(..) command is used to construct a Matrix-type object that is used by the routines in the LinearAlgebra package. This command can accept a linalg matrix as a parameter, and it is by this method that an object of type matrix can be converted to an object of type Matrix. Similarly, the Vector(..) command can be used to convert an object of type vector to an object of type Vector.