Until now, Wiris CAS was the tool for writing the algorithms in Wiris Quizzes Studio. Now, CalcMe has replaced Wiris CAS as the calculator in the Variables tab. If you have questions using Wiris CAS, we recommend you to see the CalcMe integration guide where the reasons for the update and how to make the transition from the old algorithms to the new ones are explained.

This tab is at the core of many of Wiris Quizzes' capabilities. We define variables here in a computer algebra system (CAS), and these are used in various parts of the question definition, mainly in the question's statement and correct answer. If you're familiar with CalcMe or Wiris CAS then you have a head start. If not, it's easy to get started. You can think of it as a big scientific calculator, but which can also manipulate symbolic equations. You can always check CalcMe basic guide (or CAS basic guide).

Declaring variables

Variables are defined by writing a name for a variable, an equals sign and an expression on the right-hand side. For example:

Wiris CAS CalcMe

There are two details to note:

Declaring variables

  • 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, be it numerical (as in the first variable above) or algebraic (as in the second).

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:

Wiris CAS CalcMe

Only for Wiris CAS: We're using the space outside the yellow variables box to test the value of new_variable. This is what it is intended for. None of what is written outside of the box is used in the question at all; the space is just for testing variables and instructions whenever it might be necessary.

Algorithm language

The algorithm field is available in multiple languages. By default, the language of the CAS will be the same as the 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 in it will be automatically translated. This is very useful if you have algorithms in other languages, like the ones in STEM collection.

Inserting variables

Those are the basics of how variables function inside of Wiris Quizzes Studio. What's very important though, is to know how to use these variables outside of Studio. The answer is simple:

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:

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 to introduce randomness in a question. There is a simple instruction in CalcMe that generates random numbers, random(). For example,

Wiris CAS CalcMe

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.

There are many ways to exploit this feature, and we list a few of them ourselves in the basic guide. Similarly, if you want to see examples of questions that use randomness at different levels, you can see their dedicated page
If you are interested in having the same random seed for the same student, learn how to do it here.

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 generate values in different notations.

Only for Wiris CAS: If you are still using the old calculator, these output options must be configured from Variables tab of Wiris Quizzes Studio.

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

For a complete detailed information about tolerance, precision and notation, visit our dedicated page.


These notations apply only to decimal numbers. Numbers and expressions without a decimal point in them are exact, and so these notations don't apply to them. You can always convert an exact expression to decimal by multiplying by 1.0 for instance.

For a complete detailed information about tolerance, precision and notation, visit our dedicated page.


Choose the symbol for the decimal mark. Available options depend on the symbols in Validation tab, in Options... > Separators marked as Decimal digits. Trailing decimal points of integer numbers are never shown.


Choose the symbol for the digit groups separator, that is, thousands separator. Available options depend on the symbols in Validation tab, in Options... > Separators marked as Digit groups.

List items

Choose the symbol for the list items separator. Available options depend on the symbols in Validation tab, in Options... > Separators marked as List items.