Back to the table of contents

Matrix functions

9.1 Calculation of the transposed matrix

To compute the transpose of the matrix $ A $ must run transpose(A) or $ \mathbf {A \widehat { } {T } } $.

No result yet

9.2 The calculation of adjoint and inverse matrices

The calculation of inverse matrix

To calculate the inverse matrix for the matrix A, to execute inverse(A) or $\mathbf{A\widehat{ } {(-1)}}$.

No result yet

No result yet

Calculation of adjoint matrix

To calculate the adjoint matrix for a given matrix $A$ execute adjoint(A) or $\mathbf{A\widehat{ }{\backslash star}}$.

No result yet

No result yet

9.3 Calculation of the matrix determinant

To calculate the determinant of $A$, you must run det(A).

No result yet

No result yet

No result yet

No result yet

9.4 Calculation of the conjugate matrix

To calculate the conjugate matrix, you must run conjugate(A) or $\mathbf {A\widehat{ } { \backslash ast}}$.

No result yet

9.5 Calculation of the generalized inverse matrix

To compute the generalized inverse Murr-Penrose matrix must run genInverse(A) or $\mathbf{A\widehat{ } {+}}$.

No result yet

9.6 Computation of the kernel and echelon form

Computation of the echelon form

To compute the echelon form of the matrix $A$, you should run toEchelonForm(A).

No result yet

No result yet

Computation of the kernel

To calculate the kernel of matrix $A$, you should run kernel(A).

No result yet

No result yet

9.7 Calculating the characteristic polynomial of matrix

To calculate the characteristic polynomial of the matrix A with entries in $R[x_1,…,x_m]$, you should give the ring $R[x_1,…,x_m]R[t]$ or $R[t,x_1,…,x_m]$ with some new variable $t$ and run charPolynom(A).

No result yet

No result yet

9.8 Calculating LDU-decomposition of the matrix

To calculate the LDU-decomposition of the matrix A, you must run LDU(A).

The result is a vector of three matrices $[L,D,U]$. Where $L$ is a lower triangular matrix, $U$ — upper triangular matrix, $D$ — permutation matrix, multiplied by the inverse of the diagonal matrix. If the elements of the matrix A are elements of commutative domain R, then elements of matrices $L$, $D^{-1}$, $U$ are elements of the same domain R.

No result yet

No result yet

No result yet

9.9 Calculating Bruhat decomposition of the matrix

To calculate the Bruhat decomposition of the matrix A, you must run BruhatDecomposition(A).

The result is a vector of three matrices $[V,D,U]$. Where $V$ and $U$ — upper triangular matrices, $D$ — permutation matrix, multiplied by the inverse of the diagonal matrix. If the elements of the matrix $A$ are elements of commutative domain $R$, then elements of matrices $V$, $D^{-1}$, $U$ are elements of the same domain $R$.

No result yet

No result yet

9.10 Linear programming

Let there be given the objective function $\sum_{j = 1}^n c_j x_j$ and conditions $$\sum_{j = 1}^n a_{ij}x_j\leqslant b_i,\text{ here }i = 1,2,…,m,$$ $$x_j\geqslant 0,\text{ here }j = 1,2,…,n.$$

We define $m\times n$-matrix $A = (a_{ij})$, $ m $-dimensional vector $b = (b_i)$, $n$-dimensional vector $c = (c_j)$ and $n$-dimensional vector $x = (x_j)$.

Then the objective function can be written as $c^Tx,$ and and conditions can be written as $$Ax \leqslant b,$$ $$ x \geqslant 0.$$

For solving linear programming problems, you can use one of the following two commands SimplexMax or SimplexMin. The result is a vector.

Depending on the type of problem you have the following options.

1. To solve the problem $$c^Tx \rightarrow max$$ under conditions $$Ax \leqslant b,$$ $$ x \geqslant 0,$$ we use the SimplexMax(A, b, c).

If the objective function needs to be minimized, , i.e. $$c^Tx \rightarrow min,$$ then we use the SimplexMin(A, b, c).

Example.

We need to maximize the $$3x_1 + x_2 + 2x_3$$ under the conditions $$ x_1 + x_2 + 3x_3 \leqslant 30, 2x_1 + 2x_2 + 5x_3 \leqslant 24, 4x_1 + x_2 + 2x_3 \leqslant 36, x_1, x_2, x_3 \geqslant 0. $$

No result yet

2. To solve the problem $$c^Tx \rightarrow max$$ under the conditions $$A_1 x\leqslant b_1,$$ $$A_2 x= b_2,$$ $$ x \geqslant 0,$$ we use the SimplexMax(A_1,A_2, b_1, b_2, c).

If the objective function needs to be minimized, i.e. $$c^Tx \rightarrow min,$$ then we use the SimplexMin(A_1,A_2, b_1, b_2, c).

Example.

We need to maximize the $$7x_1 + x_3 - 4x_4$$

under the conditions $$ x_1 - x_2 + 2x_3 - x_4 \leqslant 6, 2x_1 + x_2 - x_3 = -1, x_1, x_2, x_3, x_4 \geqslant 0. $$

No result yet

3. To solve the problem $$c^Tx \rightarrow max$$ under the conditions $$A_1 x\leqslant b_1,$$ $$A_2 x= b_2,$$ $$A_3 x\geqslant b_3,$$ we use the SimplexMax(A_1,A_2, A_3,b_1, b_2, b_3,c).

If the objective function needs to be minimized, i.e. $$c^Tx \rightarrow min,$$ then we use the SimplexMin(A_1,A_2, A_3,b_1, b_2, b_3, c).

Example.

$$7x_1 + x_3 - 4x_4$$ We need to maximize the $$x_1 + x_2$$ under the conditions $$ 4x_1 - x_2 \leqslant 8, 2x_1 + x_2 \leqslant 10, -5x_1 + 2x_2 \geqslant -2, x_1, x_2 \geqslant 0. $$

No result yet

4. To solve the problem $$c^Tx \rightarrow max$$ in mixed conditions desired by the matrix $A$ and vector $b$, you can use the command SimplexMax(A,signs,b,c), where an array of integers $ signs $ determines the signs of comparison:

-1 means "less than or equal to",

0 means "equal to",

1 means "greater than or equal to".

The array $signs$ must contain the same number of elements as the vector $ b $. If the objective function needs to be minimized, i.e. $$c^Tx \rightarrow min,$$ then we use the SimplexMin(A,signs,b,c).

Example.

We need to minimize the $$-2x_1-4x_2-2x_3$$ under the conditions

$$ -2x_1 + x_2 + x_3 \leqslant 4, - x_1 + x_2 + 3x_3 \leqslant 6, x_1 - 3x_2 + x_3 \leqslant 2, x_1, x_2, x_3 \geqslant 0. $$ In:

No result yet

Back to the table of contents