The trace command computes the trace of a square matrix A.
trace([[1,2],[3,4]]); 5 trace([[a,b],[c,d]]); d+a