2.86 How flip an array around?
Given \(A=[1,2,3,4,5]\) change it to \(A=[5,4,3,2,1]\)
| Mathematica
a = {1, 2, 3, 4, 5};
Reverse[a]
|
{5, 4, 3, 2, 1}
|
| Matlab
A=[1,2,3,4,5];
flip(A)
|
ans =
5 4 3 2 1
|
| Maple
A:=Array([1,2,3,4,5]);
ArrayTools:-Reverse(A);
|
[5, 4, 3, 2, 1]
|