Documentation Center

  • Trial Software
  • Product Updates

linalg::tr

Trace of a matrix

Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

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?