 Diagonal - Maple Help

LinearAlgebra

 Diagonal
 return a sequence of Vector(s) from a Matrix Calling Sequence Diagonal(A, L, options) Parameters

 A - Matrix L - (optional) integer, range with integer endpoints, or list of integers and/or ranges with integer endpoints; represents a diagonal selection options - (optional); constructor options for the result object(s) Description

 • The Diagonal(A) command returns the main diagonal of the Matrix A as a (column) Vector.
 • The Diagonal(A, L) command returns an expression sequence of one or more (column) Vectors corresponding to the specified diagonals of Matrix A, as determined by the selection parameter L, which can be an integer, a range with integer endpoints or a list of integers and/or ranges with integer endpoints.
 The diagonals of the Matrix A 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.  In particular, for this command, negative integers are not interpreted as indexing backwards from the end.  (Compare Row.)
 • The constructor options provide additional information (orientation, readonly, shape, storage, order, datatype, and attributes) to the Vector constructor that builds the result. These options may also be provided in the form outputoptions=[...], where [...] represents a Maple list.  If a constructor option is provided in both the calling sequence directly and in an outputoptions option, the latter takes precedence (regardless of the order).
 If constructor options are specified in the calling sequence, each resulting Vector has the same specified options.
 • This function is part of the LinearAlgebra package, and so it can be used in the form Diagonal(..) only after executing the command with(LinearAlgebra). However, it can always be accessed through the long form of the command by using LinearAlgebra[Diagonal](..). Examples

 > $\mathrm{with}\left(\mathrm{LinearAlgebra}\right):$
 > $A≔⟨⟨1,2,3⟩|⟨4,5,6⟩|⟨7,8,9⟩|⟨10,11,12⟩⟩$
 ${A}{≔}\left[\begin{array}{cccc}{1}& {4}& {7}& {10}\\ {2}& {5}& {8}& {11}\\ {3}& {6}& {9}& {12}\end{array}\right]$ (1)
 > $\mathrm{Diagonal}\left(A\right)$
 $\left[\begin{array}{c}{1}\\ {5}\\ {9}\end{array}\right]$ (2)
 > $\mathrm{Diagonal}\left(A,-1,\mathrm{orientation}=\mathrm{row}\right)$
 $\left[\begin{array}{cc}{2}& {6}\end{array}\right]$ (3)
 > $\mathrm{Diagonal}\left(A,\left[2,-1..1\right]\right)$
 $\left[\begin{array}{c}{7}\\ {11}\end{array}\right]{,}\left[\begin{array}{c}{2}\\ {6}\end{array}\right]{,}\left[\begin{array}{c}{1}\\ {5}\\ {9}\end{array}\right]{,}\left[\begin{array}{c}{4}\\ {8}\\ {12}\end{array}\right]$ (4)