Exercises

MathMatize Variables & Simplification

How to author randomized exercises with the use of MathMatize variables

MathMatize Variables & Simplification

The MathMatize exercise editor provides an intuitive interface, a variable form, to create randomized exercises. The variable form is also the place to define user-defined custom functions. Randomization is introduced with the insertion of random variables in the exercise with the syntax [[variableName]]. Random variables may be inserted in the question content, hint, solution, blank answers, and in the variable form fields. NOTE: User-defined functions are inserted using function notation and not with the [[variableName]] syntax.

There are two basic ways to create random numeric values in a range:

  • Random integer variable returns an integer between a minimum and maximum, and with a given step size. It is also possible to provide a skip value, to be excluded from the list, e.g. if the random number is to serve as a divisor zero can be excluded by entering 0 as the skip value.
  • Random real variable returns a fixed precision real number between a minimum and a maximum value, and with a specified precision (number of decimal places).

To select a value randomly from a list of pre-defined values instead of a range:

  • Random from list variable returns a value from a custom list of values (numbers, expressions, etc.) created by the user.

For text-based randomization, a fourth type of random variable is available:

  • Random from list (text) variable returns a text string from a custom list of text values created by the user. This variable type supports plain text and LaTeX formatting using $ delimiters (e.g., $x^2 + 1$). Unlike the numeric random list, these text values are not mathematically evaluated but can be used for textual content and choices in exercises.

Finally, to randomly permute values from a pre-defined list to a set of variables, use the following pair of variable types:

  • List variable stores a custom list of values (numbers, expressions, etc.) whose elements may be shuffled randomly.
  • List Element variable returns one element of a List type variable specified by a 1-based index.

Once random variables have been created the next step in exercise creation involves manipulating these variables. The variable form allows the creation of mathematical expressions involving random variables:

  • Expression type variables are used to create a mathematical expressions (potentially referencing random variables). Expressions involving random variables can be simplified in a variety of preset ways (see below).

The real potential of random variables in exercises is unlocked when an exercise can display different content and request different responses based on the value of the random variable. MathMatize offers four types of Logic variables that allow instructors to assign a value depending on the value of one or more random variables:

  • Comparison variable returns a boolean value based on a comparison between two (possibly) random values/variables.
  • Compound Logic variable return a boolean value that is the result of a boolean arithmetic expression composed of Comparison variables, boolean values (true and false), and boolean operators (and, or, and not).
  • Numeric Conditional variable returns a number/math expression based on whether the Comparison/Compound Logic variable is true or false.
  • Text Conditional variable returns a text/string expression based on whether the Comparison/Compound Logic variable is true or false.

Math expressions in Random from list, Expression, Comparison, and Numeric Conditional variables can also include units.

Simplification

Instructors can choose to apply one of four predetermined levels of simplification to the random Expression type variables and to math blank answers. To illustrate the the effects of different simplification levels consider the following random variables and their values: v1 ↦ 5, v2 ↦ 9 and v3 ↦ \sqrt{[[v1]]}\sqrt{[[v2]]}

  • Add brackets around substituted variables: Substitute random variable values with parenthesis, so v3 will simplify to \sqrt{(5)}\sqrt{(9)}
  • Optimize brackets: Substitute random variable values and clean up parenthesis, so v3 will simplify to \sqrt{5}\sqrt{9}
  • Partial simplify: Substitute variables, clean up brackets, drop trivial factors and terms (not available for expressions with units)
  • Simplify: Simplify to exact values when expression does not include units, so v3 will simplify to 3\sqrt{5}. If the units are included expression will be evaluated to 6 decimal places instead.
  • Evaluate to decimals: Simplify to decimals with given precision when expression evaluates to a constant, so v3 will simplify to 6.71 when precision is set to 2.

See also: