Reverse - Maple Help

ArrayTools

 Reverse
 reverse the entries of a Matrix, Vector, or Array

 Calling Sequence Reverse(A)

Parameters

 A - Matrix, Vector, or Array

Options

 • inplace : (optional) true or false, with default false

Description

 • The Reverse command reverses the elements of a Matrix, Vector, or Array into a new Matrix, Vector, or Array of the same shape.
 • When inplace=true, the reversal of elements is performed in-place.

Examples

 > $\mathrm{with}\left(\mathrm{ArrayTools}\right):$
 > $A≔\mathrm{Array}\left(\left[1,2,3,4\right]\right)$
 ${A}{≔}\left[\begin{array}{cccc}{1}& {2}& {3}& {4}\end{array}\right]$ (1)
 > $\mathrm{Reverse}\left(A\right)$
 $\left[\begin{array}{cccc}{4}& {3}& {2}& {1}\end{array}\right]$ (2)
 > $B≔\mathrm{Vector}\left(\left["a","b","c","d","e"\right]\right)$
 ${B}{≔}\left[\begin{array}{c}{"a"}\\ {"b"}\\ {"c"}\\ {"d"}\\ {"e"}\end{array}\right]$ (3)
 > $\mathrm{Reverse}\left(B,'\mathrm{inplace}'\right):$
 > $B$
 $\left[\begin{array}{c}{"e"}\\ {"d"}\\ {"c"}\\ {"b"}\\ {"a"}\end{array}\right]$ (4)

Compatibility

 • The ArrayTools[Reverse] command was introduced in Maple 2019.