triu - Maple Help

MTM

 triu
 compute the upper triangular matrix

 Calling Sequence triu(A) triu(A,k)

Parameters

 A - matrix, vector, array, or scalar k - (optional) integer

Description

 • For a matrix A, the triu(A) command returns a matrix R where R[i,j] = A[i,j] when R[i,j] is on or above the main diagonal of R. R[i,j] = 0 otherwise.
 • For a matrix A, the triu(A,k) command returns a matrix R where R[i,j] = A[i,j] when R[i,j] is on or above the diagonal of R indexed by k. R[i,j] = 0 otherwise.
 • The diagonals of a matrix are indexed using signed integers, where the main diagonal has index 0. Superdiagonals are indexed with positive integers and subdiagonals are indexed with negative integers.

Examples

 > $\mathrm{with}\left(\mathrm{MTM}\right):$
 > $A≔\mathrm{Matrix}\left(\left[\left[1,2,1\right],\left[4,5,6\right],\left[2,8,1\right]\right]\right)$
 ${A}{≔}\left[\begin{array}{ccc}{1}& {2}& {1}\\ {4}& {5}& {6}\\ {2}& {8}& {1}\end{array}\right]$ (1)
 > $\mathrm{triu}\left(A\right)$
 $\left[\begin{array}{ccc}{1}& {2}& {1}\\ {0}& {5}& {6}\\ {0}& {0}& {1}\end{array}\right]$ (2)
 > $\mathrm{triu}\left(A,1\right)$
 $\left[\begin{array}{ccc}{0}& {2}& {1}\\ {0}& {0}& {6}\\ {0}& {0}& {0}\end{array}\right]$ (3)
 > $\mathrm{triu}\left(A,-1\right)$
 $\left[\begin{array}{ccc}{1}& {2}& {1}\\ {4}& {5}& {6}\\ {0}& {8}& {1}\end{array}\right]$ (4)