Matrix functions in Mathcad

Mathсad has in itself more than 50 functions, which perform operations with vectors and matrixes. All the functions can be subdivided into groups according to their functionality. For instance: functions which create matrixes of general and specific kind, functions for matrix editing and conversion, functions which define matrix parameters, etc. Let’s study the functions, which have the major applied value.  

Among functions, which are in use for making matrixes it is important to mention function matrix(L,N,f), where Lis the number of matrix rows,N– the number of matrix columns,f– functionf(l,n) . Another function of the same group is identity(n). It is in use to make the unity function of dimensionn. The next function geninv(M) let us carry out inversion of matrix M, which is similar to operation M-1.

In order to define matrix dimension, Mathcad offers function rows(M), which defines the number of rows of matrix M, and function cols(M), which defines the number of columns of matrixM.

Sorting of matrix constituents is performed by two functions csort(M,i),rsort(M,j). Functioncsort(M,i) performs ascending sorting of i–column constituents by permutation of rows, and function rsort(M,j) performs ascending sorting of j–row constituents by permutation of columns.

In order to define the minimal and maximal matrix constituents two functions min(M)and max(M) are in use.

You can select the random submatrix from matrix Мin Mathcad by applying function submatrix (M, r1, r2, c1, c2), whereМ is the specified function,r1andr2are the lower and the upper row numbers of matrix М, which then become consistent elements of final submatrix, ас1andс2 are the lower and the upper column numbers of matrix М, which then become consistent elements of final submatrix. Augmentation of matrixes can be performed with the help of functions augment(A,B,…)andstack(A,B,…). Function augment(A,B,…) is applied for merging of matrixes  А, В etc. from left to right, the number of rows in matrixes should be the same. The other function stack(A,B,…) is applied for merging matrixes top-down. The number of columns in matrixes should also be the same. The discussed functions could be applied to vectors as well. The programme listing shows the example of the discussed matrix functions in use.

 Matrix Functions