1
$\begingroup$

Some background. I can use Mathematica to generate text book problems/exercises and corresponding answer in two "pairs/synched" lists $L_{Q}$ and $L_{A}$ (i.e. element 1 in each list is a Q&A pair, element 2 in each list is a new Q&A pair). (I later save the lists as files and use in word processor, $L_{Q}$ for the Qs and $L_{A}$ for the As.

Some topics, like exponential expressions, can have multiple "m.o." like product, fraction, exponential of exponential etc. For each such topic I can make Q&A lists. This is fine when making exercises for student to learn a certain method only, to focus on one subject and repeat and learn.

I now want to make a more "general" and "mixed" Q&A section for the students, merging paired Q&A lists into one paired Q&A list that is made by picking randomly from the other lists. I.e.

$\{L_{1Q},L_{1A}\}$, $\{L_{2Q},L_{2A}\}$, $\{L_{3Q},L_{3A}\}$, … is paired Q&A lists

$\{L_{mixedQ},L_{mixedA}\}$ is a randomly merged list with elements from $\{L_{iQ},L_{iA}\}$

We can assume that lists $\{L_{iQ},L_{iA}\}$ have equal length for simplicity. If it can be solved for variable length, that is fine too.

Can this be done in Mathematica? I could import the problems in a database and from there randomly pick pairs, but it would be neater to do it from Mathematica.

(I made them as two separate lists and it might be that there are better and more efficient ways to do it. My Mathematica skills are somewhat limited…)

TIA!

$\endgroup$
0
$\begingroup$
{lQ1, lQ2, lQ3} = Array[qq, {3, 5}]

{{qq[1, 1], qq[1, 2], qq[1, 3], qq[1, 4], qq[1, 5]},
{qq[2, 1], qq[2, 2], qq[2, 3], qq[2, 4], qq[2, 5]},
{qq[3, 1], qq[3, 2], qq[3, 3], qq[3, 4], qq[3, 5]}}

{lA1, lA2, lA3} = Array[aa, {3, 5}];

{{aa[1, 1], aa[1, 2], aa[1, 3], aa[1, 4], aa[1, 5]},
{aa[2, 1], aa[2, 2], aa[2, 3], aa[2, 4], aa[2, 5]},
{aa[3, 1], aa[3, 2], aa[3, 3], aa[3, 4], aa[3, 5]}}

mixedlist = {{lQ1, lA1}, {lQ2, lA2}, {lQ3, lA3}};

{lMixedQ, lMixedA} = Transpose[RandomChoice[Transpose[Join[## & @@ mixedlist, 2]], 4]]

{{qq[2, 2], qq[1, 4], qq[3, 1], qq[1, 5]},
{aa[2, 2], aa[1, 4], aa[3, 1], aa[1, 5]}}

$\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.