## Variables

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:

**#**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:

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

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

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

#### Notation

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.

#### Decimal

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.

#### Thousands

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