tr | R Documentation |
Computes the trace of a matrix.
tr(x)
x |
a numeric matrix. |
tr
computes the trace of a square matrix, i.e., the sum of
its diagonal elements.
If the matrix is not square, tr
returns NA
.
Golub, van Loan, (1996); Matrix Computations, 3rd edition. Johns Hopkins University Press.
## Create Pascal Matrix:
P = pascal(3)
P
tr(P)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.