powered by
Computes the trace of a matrix.
tr(x)
a numeric matrix.
tr computes the trace of a square matrix, i.e., the sum of its diagonal elements.
tr
If the matrix is not square, tr returns NA.
NA
Golub, van Loan, (1996); Matrix Computations, 3rd edition. Johns Hopkins University Press.
## Create Pascal Matrix: P = pascal(3) P tr(P)
Run the code above in your browser using DataLab