Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

linalg::tr

Trace of a matrix

MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

Syntax

linalg::tr(A)

Description

linalg::tr(A) returns the trace of the square matrix A, i.e., the sum of the diagonal elements of A.

Examples

Example 1

We compute the trace of the following matrix:

A := Dom::Matrix(Dom::Integer)
  (3, 3, (i, j) -> 3*(i - 1) + j)

linalg::tr(A)

Parameters

A

A square matrix of a domain of category Cat::Matrix

Return Values

Element of the component ring of A.

See Also

MuPAD Functions

More About

Was this topic helpful?