PRODUCTS
Mathematica
Mathematica Home Edition
Mathematica for Students
Mathematica for the Classroom
grid
Mathematica
Wolfram Lightweight Grid Manager
web
Mathematica
Mathematica Player
(free download)
Mathematica Player Pro
Wolfram
Workbench
Mathematica
Applications
SOLUTIONS
Industry
Chemical Engineering
Image Processing
Mechanical Engineering
Petroleum Engineering
Environmental Sciences
Bioinformatics
Data Analysis and Mining
Financial Risk Management
Statistics
Software Engineering
More...
Education
Higher Education
Precollege Education
Students
Technology
Interactive Deployment
High-Performance and Parallel Computing (HPC)
See Also: Technology Guide
PURCHASE
Online Store
Other Ways to Buy
Volume & Site Licensing
Contact Sales
Software
Service
Upgrades
Training
Books
FOR USERS
All User Resources
Product Registration
Technical Support
Customer Service
Developer Support
Does My Site Have a License?
Free Seminars
Learning Center
Training
Custom Group Seminars
Documentation & Examples
Tutorial Screencasts
Video Gallery
Demonstrations Project
Education Portal
Student Resources
COMPANY
About Wolfram Research
News & Events
Wolfram Blog
Employment Opportunities
History of
Mathematica
Stephen Wolfram's Home Page
Contact Us
OUR SITES
Wolfram|Alpha
Demonstrations Project
Wolfram Blog
MathWorld
Integrator
Wolfram Functions Site
Mathematica Journal
Wolfram Library Archive
Wolfram
Tones
Wolfram Science
Stephen Wolfram
DOCUMENTATION CENTER SEARCH
Mathematica
>
Mathematics and Algorithms
>
Matrices and Linear Algebra
>
Matrix Operations
>
Built-in
Mathematica
Symbol
Basic Matrix Operations
Vectors and Matrices
Tensors
Tutorials »
|
Total
Diagonal
Transpose
Det
DiagonalMatrix
Eigenvalues
See Also »
|
Matrices and Linear Algebra
Matrix Operations
Tensors
More About »
Tr
Tr
[
list
]
finds the trace of the matrix or tensor
list
.
Tr
[
list
,
f
]
finds a generalized trace, combining terms with
f
instead of
Plus
.
Tr
[
list
,
f
,
n
]
goes down to level
n
in
list
.
MORE INFORMATION
Tr
[
list
]
sums the diagonal elements
list
[[
i
,
i
,
...
]]
.
Tr
works for rectangular as well as square matrices and tensors.
Tr
can be used on
SparseArray
objects.
»
EXAMPLES
CLOSE ALL
Basic Examples
(1)
The trace of a matrix is the sum of the diagonal elements:
In[1]:=
Out[1]=
Scope
(2)
Generalizations & Extensions
(6)
Applications
(2)
Properties & Relations
(2)
SEE ALSO
Total
Diagonal
Transpose
Det
DiagonalMatrix
Eigenvalues
TUTORIALS
Basic Matrix Operations
Vectors and Matrices
Tensors
MORE ABOUT
Matrices and Linear Algebra
Matrix Operations
Tensors
New in 4 | Last modified in 5