Learn R Programming

Ryacas (version 1.1.5)

tr: Matrix Trace

Description

The trace of a square matrix is the sum of the diagonal elements.

Usage

tr(x, ...)

# S3 method for default tr(x, ...)

Arguments

x

If yac_symbol treat as such, else call tr.default().

...

further arguments passed to tr.default()

Examples

Run this code
(x <- matrix(1:4, ncol = 2))
tr(x)
tr(ysym(x))

Run the code above in your browser using DataLab