-
MathType
-
Wiris Quizzes
-
Learning Lemur
-
CalcMe
-
MathPlayer
-
Store FAQ
-
VPAT for the electronic documentation
-
MathFlow
-
BF FAQ
Generating tables from matrices
Reading time: 2minWirisQuizzes supports the option of rendering matrix variables as tables. In other words, entries in a matrix can optionally be visualized as individual cells in a table. Or from another viewpoint, table cells can be more easily manipulated in CalcMe by storing them all in a matrix.
Basics
The most basic instance of this feature is actually a beneficial one. Placing an nxm matrix variable inside a 1x1 table will create a table with n rows and m columns, each cell containing the corresponding matrix entry. Let's take a look. The 1x1 table in the editor
where M is defined, for example, as
produces the following table when we view the question:
As mentioned previously, this means we can essentially store and edit arbitrary tables as matrices in CalcMe. As with lists, this feature also works when the matrix variable has other cells around it. A short example would be:
and
in the question statement, it looks like this:
In general, if other cells are present (as opposed to placing a matrix in a one-cell table like above), the space for the matrix should already be there, in at least one dimension (because the table expansion will avoid creating empty cells). In the previous example, the table already had the same number of columns as the matrix, and we could have added as many rows as desired.
Lastly, note that automatic table expansion will avoid overwriting existing cells. Use the following example as a guideline:
with M as before, this does not overwrite the occupied cell and simply creates a table with all of M inside one cell:
Random tables
Analogous to the list functionality, matrices can also be used to generate random tables. The idea is precisely the same as with lists, we only need to know how to declare a random matrix variable, and the table that results will automatically adapt. We should be familiar with the "list of lists" syntax for matrices to declare a random matrix. It's straightforward, though; each bracketed list is just a matrix row:
To make a table, we could also use curly brackets {} instead of square brackets. However, we should be aware that the resulting object in CalcMe, in this case, will be an actual list of lists and not a matrix. Anyhow, let's try this in the question editor, and add some randomness with the help of list comprehension:
If we place N as in the first example on this page, we'll have achieved a table with random integer entries, with m rows and n columns, where n and m are also randomized. A more straightforward way of making a random matrix may suffice in some cases, for example:
It gives us a matrix of fixed size but with one variable entry. Again, the possibilities for declaring random matrices are as many as our creativity allows.