-
MathType
-
WirisQuizzes
-
LearningLemur
-
CalcMe
-
MathPlayer
-
Store FAQ
-
VPAT for the electronic documentation
-
MathFlow
-
BF FAQ
-
Miscellaneous
-
Wiris Integrations
Linear Algebra Functions
Reading time: 2minThis section describes functions for working with linear algebra objects and operations, including matrices, vectors, and common matrix properties. These functions support tasks such as constructing matrices and vectors, computing determinants and inverses, extracting dimensions, and working with eigenvalues and eigenvectors.
Tip: For practical examples showing how these functions are used when generating exercises, see the Examples section.
Function Reference
adjoint_matrix
Description
Computes the adjoint (adjugate) matrix of a matrix.
Syntax
adjoint_matrix(Matrix)
Returns
The adjoint matrix of the input matrix.
constant_matrix
Description
Constructs a matrix with all entries equal to the same expression.
Syntax
constant_matrix(Integer, Expression)
constant_matrix(Integer, Integer, Expression)
Returns
A matrix filled with the expression e. When called as constant_matrix(n, e), the resulting matrix is square (dimensions depend on the system definition). When called as constant_matrix(n, m, e), the resulting matrix has dimensions n×m.
Notes
- Use the three-argument form when you need explicit dimensions.
constant_vector
Description
Constructs a vector with all entries equal to the same expression.
Syntax
constant_vector(Integer, Expression)
Returns
A vector of length n where each entry is the expression e.
determinant
Description
Computes the determinant of a matrix.
Syntax
determinant(Matrix)
Returns
The determinant of the input matrix.
diagonal_matrix
Description
Constructs a diagonal matrix from a sequence of values or from a constant expression.
Syntax
diagonal_matrix(List | Range | Vector)
diagonal_matrix(Integer, Expression)
Returns
When called with a list, range, or vector L, returns a diagonal matrix with the elements of L on the diagonal. When called with n and e, returns an n×n diagonal matrix with diagonal entries equal to e.
dimensions
Description
Returns the dimensions of a matrix.
Syntax
dimensions(Matrix)
Returns
A two-element list: number of rows, and number of columns.
eigenvalues
Description
Computes the eigenvalues of a matrix over ℝ (repeated eigenvalues are included).
Syntax
eigenvalues(Matrix)
Returns
A list containing the eigenvalues of the matrix over ℝ. Repeated eigenvalues are not omitted.
eigenvectors
Description
Computes the eigenvectors of a matrix over ℝ and returns them arranged in columns.
Syntax
eigenvectors(Matrix)
Returns
A matrix whose columns are the eigenvectors of the input matrix over ℝ.
identity_matrix
Description
Constructs the identity matrix of size n×n.
Syntax
identity_matrix(Integer)
Returns
The identity matrix of dimensions n×n.
inverse
Description
Computes the inverse of a matrix.
Syntax
inverse(Matrix)
Returns
The inverse of the input matrix.
Notes
- If the matrix is not invertible, the system behavior depends on the implementation (for example, error or undefined result).
jordan
Description
Computes the Jordan decomposition of a matrix.
Syntax
jordan(Matrix)
jordan(Matrix, transformation_matrix=true)
Returns
By default, returns the Jordan matrix J. If transformation_matrix=true, returns a list containing J and the transformation matrix P.
Notes
- In a Jordan decomposition, the matrix is expressed as
A = P-1 J P. - The structure of
Jdepends on the eigenvalues ofA.

linearly_independents?
Description
Checks whether a set of vectors is linearly independent.
Syntax
linearly_independents?(Vector, ..., Vector)
linearly_independents?(List)
Returns
true if the vectors are linearly independent; otherwise false.
norm
Description
Computes the norm of a vector.
Syntax
norm(Vector)
Returns
The norm (magnitude) of the input vector.
n_columns
Description
Returns the number of columns in a matrix.
Syntax
n_columns(Matrix)
Returns
The number of columns of the input matrix.
n_rows
Description
Returns the number of rows in a matrix.
Syntax
n_rows(Matrix)
Returns
The number of rows of the input matrix.
rank
Description
Computes the rank of a matrix.
Syntax
rank(Matrix)
Returns
The rank of the input matrix.
trace
Description
Computes the trace of a matrix.
Syntax
trace(Matrix)
Returns
The trace of the input matrix.
transpose
Description
Computes the transpose of a matrix.
Syntax
transpose(Matrix)
Returns
The transpose of the input matrix.
vectorial_product
Description
Computes the vector product (cross product) of two vectors in ℝ³.
Syntax
vectorial_product(Vector, Vector)
Returns
The vector (cross) product of the two input vectors.
Notes
- This operation is defined for vectors in three-dimensional space (ℝ³).

versor
Description
Normalizes a vector (returns its versor).
Syntax
versor(Vector)
Returns
A vector with the same direction as the input but with norm equal to 1.
Notes
- If the input vector has norm 0, the system behavior depends on the implementation (for example, error or undefined result).