# generating random algebraic matrix using elementary operations

I generate several algebraic matrices of 12x12 where each element is a combination no repeat of the variables x, y, z and operations +, -, *, /, power, establishment (square root), any of them or any of them

example: [x + y + z, x ^ 2 + y-z, (x + y + z) ^ 2, .....]etc.

• So, any algebraic expression like $\sqrt{1 - x^2 +y}$ or $\frac{1+x}{2+y^2}$ can be an element? – J. M. will be back soon Jun 5 '16 at 20:39
• Isn't x^2 a "repeat" of x since it is x*x? – bill s Jun 5 '16 at 22:55
• so not so complex, but may be future options – zeros Jun 6 '16 at 0:58
• By saying "no repeat"... Do you want no exact duplicates or what? – Lukas Jun 6 '16 at 4:14
• yes, example x/y and 2x/2y not – zeros Jun 6 '16 at 4:27

I'm sure there are a lot of ways to generate random functions. Here's one:

a := RandomChoice[{Times, Plus}] @@ (RandomChoice[{Sqrt, Identity, Power}] /@
(RandomSample[{x, y, z}, 3] RandomInteger[{1, 5}, 3])^RandomInteger[{-3, 3}, 3]);

To make a matrix of such functions:

Table[a, 3, 3] // MatrixForm

Of course the output is different each time. Thanks to Bill (not me -- the true bill s) for pointing out that Table[a, {i, 3}, {j, 3}] is required for versions before 10.2.

• error: Argument 3 at position 2 does not have the correct form for an iterator. >> ?????? – zeros Jun 6 '16 at 0:56
• @zeros If you click on reference.wolfram.com/language/ref/Table.html and you click on "Updated Show Changes" in the upper right corner then it will show that they changed the syntax in 10.2 to accept Table[expr,n] in addition to the older Table[expr,{n}] form. Snews to me. – Bill Jun 6 '16 at 1:23
• Thanks, I can explain this part of the code @@ and / @ . Other operations can mix ?? – zeros Jun 6 '16 at 2:40
• ok con explain,...Other operations can mix ?? – zeros Jun 6 '16 at 4:25