Mathematica Asked on November 5, 2021
I have a listo of 1000 numbers ${x_0,x_1,cdots,x_{999}}$, I need to fill a matrix with these numbers. The matrix must have this form:
$$left( begin{array}{cccc}
x_{9} &x_8 &cdots& x_0 \
x_{10} &x_9 &cdots &x_1 \
dots & cdots& cdots &cdots\
x_{999} &x_{998} & cdots& x_{990}
end{array}right)$$
I have tried with
k = 0;
line = {};
mat = {};
Do[
Do[AppendTo[line, x[[k + i]]], {i, 10}];
AppendTo[mat, line];
k = k + 1;, {j, 10}]
but it is wrong
This will do it:
Reverse /@ Partition[Range[0, 999], 10, 1]
{{9, 8, 7, 6, 5, 4, 3, 2, 1, 0}, ... {999, 998, 997, 996, 995, 994, 993, 992, 991, 990}}
Replace Range[0, 999]
by your x
.
Answered by C. E. on November 5, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP