1
$\begingroup$

I'm a little bit trouble with the below task, I'd like to make a repeting list out of a table. This is the starting point for the list

enter image description here

And I like to make them into this form: enter image description here

How should I make this? Thank you very much for the answers in advance too!

$\endgroup$
0
$\begingroup$

E.g:

S = Table[{Subscript[α, i], Subscript[μ, i]}, {i, 5}];
FoldList[Join, S]
$\endgroup$
2
$\begingroup$
arr = Array[{Subscript[a, #], Subscript[m, #]} &, 5]
Catenate /@ (Take[arr, #] &) /@ Range[5]
$\endgroup$
1
$\begingroup$

You can do this in many ways. For example:

Join @@@ Table[{Subscript[α, i], Subscript[μ, i]}, {j,  5}, {i,  j}]

{{Subscript[α, 1], Subscript[μ, 1]},
{Subscript[α, 1], Subscript[μ, 1], Subscript[α, 2], Subscript[μ, 2]},
{Subscript[α, 1], Subscript[μ, 1], Subscript[α, 2], Subscript[μ, 2], Subscript[α, 3], Subscript[μ, 3]},
{Subscript[α, 1], Subscript[μ, 1], Subscript[α, 2], Subscript[μ, 2], Subscript[α, 3], Subscript[μ, 3], Subscript[α, 4], Subscript[μ, 4]},
{Subscript[α, 1], Subscript[μ, 1], Subscript[α, 2], Subscript[μ, 2], Subscript[α, 3], Subscript[μ, 3], Subscript[α, 4], Subscript[μ, 4], Subscript[α, 5], Subscript[μ, 5]}}

TeXForm @ %

$\scriptsize\left\{\left\{\alpha _1,\mu _1\right\},\left\{\alpha _1,\mu _1,\alpha _2,\mu _2\right\},\left\{\alpha _1,\mu _1,\alpha _2,\mu _2,\alpha _3,\mu _3\right\},\left\{\alpha _1,\mu _1,\alpha _2,\mu _2,\alpha _3,\mu _3,\alpha _4,\mu _4\right\},\left\{\alpha _1,\mu _1,\alpha _2,\mu _2,\alpha _3,\mu _3,\alpha _4,\mu _4,\alpha _5,\mu _5\right\}\right\}$

Alternatively, you can use:

Flatten[Take[Table[{Subscript[α, i], Subscript[μ, i]}, {i, 5}], #]] & /@ Range[5]

Table[Flatten[{Subscript[α, #], Subscript[μ, #]} & /@ Range[i]], {i, 5}]

same result

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.