For each type of question supported, you can include algorithmically generated (random) variables in question statements, answers, hints, and feedback. Using variables in questions, you can generate variations on a single template question.
You can use more than one type of variable in a question. You can use any combination.
You can place conditions on variables. For example, you can specify that the value of a variable not exceed that of another.
Note: You can create or edit variables and algorithmically generated data using the Algorithm Designer in the Question Editor. Alternatively, you can create questions without variable data using the Question Editor, and then export the plain-text script file (with the file extension .qu) to your hard drive. Add variables by editing the questions directly in your text or HTML editor.
See Also:
Generating Random Numbers in Questions
Mathematical and Logical Operators in Algorithms and Answers
The Algorithm Designer
Algorithmic definitions of variables are of the form:
qu.x.y.algorithm= $variable1=expression; $variable2=expression; @
The following additional functions and operations are also available for use in variable definitions in algorithms.
Random integer generation (integers in a specified range, in steps of k):
Random real number generation (to k significant digits):
condition:x
See condition:x
eq(a, b)
ne(a,b)
See eq(a, b), ge(a, b), le(a, b), ne(a, b)
not(a)
See not(a)
gt(a, b)
lt(a, b)
See gt(a, b), lt(a, b)
if(a, b, c)
See if(a, b, c)
decimal(n, x)
int(x)
sig(n, x)
See decimal(n, x), sig(n, x), int(x)
lsu(n, x)
See lsu(n, x)
sum(varname, start, stop, expr)
See sum(var name, start, stop, expr)
switch(n, a, b, c, ...)
See switch(n, a, b, c, ...)
Rules for Naming Variables
You can include a computed expression anywhere within a question statement, comment, or hint.
For example, you can include expressions like ${$n + 1} in place of defining a separate variable to hold n+1. This simplifies complex algorithms.
Example
qu.1.1.question= What is the derivative of x^$n? @ qu.1.1.answer= $n x^${$n-1} @ qu.1.1.algorithm= $n=range(2,10); @
mathml(f)
Inline Display of Formatted Math Expressions
Simplified Math Expressions
Follow these rules when naming variables:
Note: The variable e should not be assigned as a global variable in Maple code. It can be used, however, as a local variable.
Functions within Algorithms