Logiciel libre de géométrie, d'analyse et de simulation multiplateforme par Yves Biton

Accueil MathGraph32 Historique

6.7 version of MathGraph32 JS : Matrix calculations

modification mercredi 23 juin 2021.

Toutes les versions de cet article : [English] [Español] [français]



6.7 version of MathGraph32 provides an important new feature : Matrix calculation

Only matrices with real cells are available.

Please remember you can use button contact on MathGraph32 site to point out an issue you came across with the software.

Download on : this page

Use mathgraph32 on line on : this page.

The different types of matrices :

A real matrix can be defined :

By giving a formula to each term of the matrix.

By providing a formula of a two variable function of variable (i, j) where i is the row index and j the column index (starting from 1)

For instance, the formula if(i=j, 1, 0) will provide an identity matrix.

By a matrix calculation :

If, for instance,A is an invertible matrix of dimensions 3x3 and B is a 3x2 matrix, the matrix calculation defined by the formula A^(-1)*B will return a 3x2 matrix (A^(-1) returning the inverse of matrix A).

But a matrix calculation defined by the formula B*A won’t exist (invalid matrix product).

By defining a matrix with random integer values :

Such a matrix is defined through the number of rows, number of lines, a minimal and a maximum values (integer).

The minimum value must be inferior to the maximum value.

When such a matrix is updated, all the cell of the matrix will be given distinct integer values ranging form min value to max value. If the difference between max and min value is not big enough, there will be repetitions (the lines being filled first)

Matrix calculartion syntax

A matrix calculation can use all items allowed for a real calculation along with operations specific to matrices.

Reference to a matrix term :

A matrix calculation can use a reference of a term belonging to a matrix already defined. For instance, if A is a matrix 3x2, A(3,2) will refer to the first term of the third row of matrix A.

Sum and difference of two matrices :

If A and B are two matrices of the same dimension, A+B returns the matrix sum and A - B returns the difference matrix of A and B.

Product of two matrices :

If A is a matrix with n rows and p columns and B a matrix with p rows and q columns, A*B returns the matrix product of A and B (matrix with n rows and q columns).

Inverse of a matrix :

if A is an invertible square matrix, A^(-1) returns the inverse matrix of A.

Power of a matrix :

If A is a matrix and n a positive integer, A^n returns the n power of matrix A. If n ≥ 256, the result doesn’t exist

Determinant of a matrix :

If A is a square matrix, deter(A) refers to the determinant of A.

Transposed of a matrix :

If A is a matrix with n rows and p columns, transp(A) returns the transposed matrix of A (matrix with p rows et n columns).

Term to term inverse of a matrix :

If A is a matrix, inv(A) returns the matrix where each term of A is replaced by the inverse. If one of the terms of A is zero, the result doesn’t exist.

Term to term product :

If A and B are two matrices of the same dimensions, dotmult(A, B) returns the matrix terms of which are the products of the matching terms of matrix A and B.

Division term by term :

If A and B are two matrices of the same dimensions and if all the terms of B are not null, A/B returns the matrix terms of which are the result of the division of A terms by the matching terms of matrix B.

Image through a predefined function :

For instance, if A is a matrix, cos(A) returns the matrix terms of which are the image of A terms through function cosinus.

Image through a user defined function :

If A is a matrix and f a user-defined real function, f(A) returns the matrix terms of which are the image of A terms through function f.

Addition of a constant :

If A is a matrix and k a real number, k + A ou A + k returns the matrix terms of which are the terms of A added with k.

Subtraction of a constant :

If A is a matrix and k a real number, A - k returns the matrix terms of which are the result of the substraction of A terms and k.

If k is a real number and A a matrix, k - A returns the matrix terms of which are the result of the substraction of k and A terms.

Multiplication by a constant :

If A is a matrix and k a number, k*A ou A*k returns the matrix terms of which are the result of the multiplication of A terms and k.

Division by a constant :

If A is a matrix and k a real number different from zero, A/k returns the matrix terms of which are the result of the division of A terms by k.

if k is a real number and A a matrix, k/A returns the matrix terms of which are the result of the division of k by A terms. The result doesn’t exist of one of A terms is zero.

Approximation by a rational fraction :

If a is a real number, frac(a) returns a matrix with one row and two columns. The first term of the returned matrix is the numerator of the approximated rational fraction of this number (with 10^(-12) uncertainty) and the second term is the denominator of the fraction.

If a is a one column matrix, frac(a) returns a matrix with two columns, the first column containing the numerators and the second column the denominators of the approximated rational fractions of each term of matrix a.

If a is a one row matrix, frac(a) returns a matrix with two rows, the first row containing the numerators and the second row the denominators of the approximated rational fractions of each term of matrix a.

To be noticed :

If the result of a matrix calculation A is a matrix of one row and one column, a reference of A in a matrix calculation will be considered as a real number.

To get the result of the determinant in a real calculation, use the tool provided in the calculation menu (expanding the calculation toolbar). The derminant will be the result of a macro-construction.