commands → trace

trace(A)

The trace command computes the trace of a square matrix A.

Examples

trace([[1,2],[3,4]]);
	5

trace([[a,b],[c,d]]);
	d+a