-
MathType
-
Wiris Quizzes
-
Learning Lemur
-
CalcMe
-
MathPlayer
-
Store FAQ
-
VPAT for the electronic documentation
-
MathFlow
-
BF FAQ
Random variables section
Reading time: 4minThe Random variables section is at the core of many of WirisQuizzes capabilities. You can make questions dynamic by adding random variables to the question's statement and to the Correct answer field accordingly. If your question only involves integer independent variables, you can use the Basic mode to define these values easily.
On the other hand, if you want to generate a more complex algorithm, you need to use the computer algebra system (CAS) by clicking on the Advanced mode button.
If you're familiar with CalcMe, then you have a head start. If not, it's easy to get started. You can think of it as an extensive scientific calculator, but it can also manipulate symbolic equations. You can always check CalcMe basic guide.
Below is a detailed description of both procedures and more information regarding when and how to use each.
Basic mode
The basic mode allows you to add up to five random variable groups to your question by clicking on the Add variable button.
For the moment, these variables need to be integers, and they can't be dependent on the previously defined ones.
Declaring variables
Variables are defined by writing a name for a variable next to the pound symbol # and the minimum and maximum value between which it's comprised.
There are two details to note:
- The variable's name can be any letter or word without spaces, excluding reserved words (e.g.
sin
,cos
). - The minimum and maximum values can be any integer value such that the first one is less or equal than the second one.
Inserting variables
Those are the basics of how variables function inside of WirisQuizzes Studio works. What's very important, though, is to know how to use these variables outside of Studio.
To include a variable anywhere within a question type, write a pound symbol # followed by the name of the variable (e.g. #a
). So we could include the above values in a question just like this:
This would appear to the student as:
Tip
It's also possible to insert these variables in the question's feedback. Furthermore, you can use the student's answer there. Learn how to do it here.
Variables evaluation
When defining the question's correct answer, we can expect the corresponding expression to be displayed as we have written it, or we want to evaluate it before showing the result to the students. To do so, we need to use the evaluate()
command and insert the variables to be simplified as its argument.
If we don't use the command mentioned above and just type √#a2+#b2, the correct answer will be displayed, as you can see below.
It won't suppose any validation problem, as the student's answer will be compared following the corresponding assertions as usual. We only recommend using the evaluate()
command to display the correct answer in a more compact way.
Transferring variables to CalcMe
You can automatically convert these basic random variables to the advanced mode if you wish. Thus, you will be able to add more variables and restrictions using all CalcMe resources.
Tip
The same happens if you delete a random variable from the quick edition mode, it will disappear from the advanced mode automatically.
Below you will find a detailed description of how CalcMe works within WirisQuizzes Studio.
Advanced mode (CalcMe)
If you want to generate a more complex algorithm where variables may be correlated or not integers, you need to use the computer algebra system (CAS). You can open it by clicking on the Advanced mode button.
What you see is CalcMe. You can think of it as an extensive scientific calculator, but it can also manipulate symbolic equations. You can always check CalcMe basic guide for further details.
Declaring variables
Variables are defined by writing a name for a variable, an equal sign, and an expression on the right-hand side. For example:
Note
If you used CalcMe before, you might have noticed some differences with previous versions. You can see further details about the new procedure to declare variables here.
Within this field, variables can be manipulated and acted on, and new variables can be defined from old ones, just as on paper. For instance:
There are two details to note:
The left-hand side can be any letter or word without spaces, excluding reserved words (e.g. sin
, cos
).
The right-hand side can be any reasonable mathematical expression, numerical (as in the first variable above) or algebraic (as in the second).
Algorithm language
The algorithm field is available in multiple languages. By default, the language of the CAS will be the same as Moodle or English as the fallback. But you can choose another one of the available languages.
If you change the CalcMe language, then any existing algorithm will be automatically translated. This is very useful if you have algorithms in other languages, like the ones in the STEM collection.
Inserting variables
Those are the basics of how variables function inside of WirisQuizzes Studio works. What's very important, though, is to know how to use these variables outside of Studio.
To include a variable anywhere within a question type, write a pound symbol # followed by the name of the variable (e.g. #a
). So we could include the above polynomial in a question just like this:
This would appear to the student as:
Tip
It's also possible to insert these variables in the question's feedback. Furthermore, you can use the student's answer there. Learn how to do it here.
Random variables
Perhaps the most important use of variables is introducing randomness in a question. There is a simple instruction in CalcMe that generates random numbers, random()
. For example,
Generates a random number between -10 and 10. This could then be used in the question text, as we have seen. The result is that each time the question is opened, a random value for a
is used. So, students viewing the same question will see potentially different values.
Tip
There are many ways to use the random()
command, and we list a few of them in the basic guide. Similarly, you can see take a look to the dedicated page if you want to see examples of questions that use randomness at different levels.
Output options
Different countries, education levels, or textbooks use different notations. You can configure some output options in the Application settings section inside CalcMe to better match the notation you use.
These options apply only to the values generated in the Algorithm field, i.e. the variables. All generated values will be in the same notation; you can not create values in different notations.
Imaginary unit
Choose between i and j (often used in electrical engineering).
Times operator
Choose between middle dot · and cross x. Set Implicit to hide all non-necessary products, that is, implicit products.
Precision
Precision must be an integer between 1 and 15 included, and it can be set as Significant figures or Decimal places. By default, it is Precision = 4 significant figures
.
All notations usually imply a rounding. When rounding, the rule used for tie-breaking is half-up.
Tip
Visit our dedicated page for complete detailed information about tolerance, precision, and notation.
Decimal
Choose the symbol for the decimal mark. Available options depend on the Validation options section symbols in Options... > Separators marked as Decimal digits. Trailing decimal points of integer numbers are never shown.
Thousands
Choose the symbol for the digit groups separator, that is, thousands separator. Available options depend on the Validation options section symbols in Options... > Separators marked as Digit groups.
List items
Choose the symbol for the list items separator. Available options depend on the Validation options section symbols in Options... > Separators marked as List items.