The IMathAS question format is based on PHP.
A question is formed in several parts:
- Description: A description of the question. This is not shown to students
- Use Rights: The rights you wish to grant other people (you always have full rights). Options are:
- Private: Only you can use the question
- Use, no modification: Anyone can use the problem, but only you can modify the problem. Anyone can add
library assignments, but cannot remove assignments.
- Use, allow modification: Anyone can use or modify the problem.
- Libraries: The question libraries you wish to include this question in
- Question type: The type of question.
- Common control: General definitions needed for both display and scoring
- Question control: Definitions only needed for question display
- Question text: The actual question display. This section should be HTML based, but
can include variables defined in the common or question control. For convenience, a blank line
is automatically interpreted to be a paragraph break. Use of < and > signs are usually
handled ok, but use of the HTML < and > are recommended in their place.
- Answer: Code defining the answer
Note: All control code can be placed in the "Common Control" box; the Question Control and Answer sections do not have to be used.
Lines of the common control, question control, and answer sections usually take the form of variable
definition. In IMathAS, variables are identified with a dollarsign ($) prefix. For example,
$a is the variable a. Most lines will take one of these forms:
- $var = number. Example: $a = 3
- $var = calculation. Example: $a = 3*$b*$c
- $var = function. Example: $a = showplot("sin(x)")
- $var = randomizer. Example: $a = rand(-5,5)
In some cases you want to define several variables at once. There are two ways to
do this:
- $var1,$var2 = arrayfunction. Example: $a,$b = diffrands(-5,5,2)
- $ar = arrayfunction. Example: $ar = diffrands(-5,5,2)
In the first example, variables $a and $b each take on a value. In the second example,
the variable $ar is an array; the elements can be accessed as $ar[0] and $ar[1] (note
that arrays are zero-indexed). If you use this approach, enclose the variable reference in
parenthesis in calculations, like $new = ($ar[0])^2, and in curly brackets inside strings,
like $string = "there were {$ar[0]} people".
You can also literally define an array using the "array" function.
Examples: $ar = array(2,3,4,5), or $ar = array("red","green","blue")
Note that numbers are not in quotes, and strings are in quotes. When you use
the double-quote mark (") to define a string, you can interpolate variables into
the string. Example:
$a = 3
$b = 5
$str = "What is $a/$b"
In this example, $str now contains "What is 3/5".
If needed, you can concatenate (combine) two strings using the . operator. Example:
$a = "string one "
$b = "string two"
$both = $a . $b
Here, $both now contains the string "string one string two"
If you have a long command to type, you can put a "&" at the end of a line to specify it continues on the next line. Example:
$questions = array("this is choice 1",&
"this is choice 2")
If defining a string for display, you can put a "&&" at the end of a line to specify it continues on the next line and insert
an HTML line break. Example:
$showanswer = "Do this first. &&
Then do this."
will be interpreted as:
$showanswer = "Do this first. <br/>Then do this."
Any assignment line can be followed by one of two conditional: "where" or "if".
"where" is used to repeat the previous assignment if the condition provided is not met. The
"where" condition is almost exclusively used with array randomizers. Example: to select two
different numbers that are not opposites:
$a,$b = diffrands(-5,5,2) where ($a+$b!=0)
"if" is used to make an assignment conditional. For example:
$a = rand(0,1)
$b = "sin(x)" if ($a==0)
$b = "cos(x)" if ($a==1)
Note the use of double equal signs (==) for testing equality. A single equal sign (=) will
make an assignment (change the value of $a in this example) and return "true", which is probably not what you intended to do.
Comparison operators available for "if" and "where" statements:
- == Equal to
- != Not equal to
- > Greater than
- < Less than
- >= Greater than or equal to
- <= Less than or equal to
To do compound conditionals, use || for "or", and && for "and". For example:
$a = nonzerorand(-9,9) where ($a!=1 && $a!=-1)
The "if" condition can also be used before or after a code block like this:
$a = rand(0,1)
if ($a==0) {
$b = 1
$c = 2
}
or
$a = rand(0,1)
{
$b = 1
$c = 2
} if ($a==0)
When "if" is used before a block of code, it can optionally be followed
with "elseif" and/or an "else" statement, like this:
$a = rand(0,5)
if ($a==0) {
$b = 1
} elseif ($a==2) {
$b = 3
} else {
$b = 2
}
"where" can also be applied to a block of code:
{
$a = rand(-5,-1)
$b = rand(1,5)
} where ($a+$b !==0)
There are several looping macros (such as calconarray) that can meet most needs. For more general use
there is a "for" loop:
for ($i=a..b) { action }
Here a and b represent whole numbers or variables. Expressions are not allowed.
Examples:
$f = 0
for ($i=1..5) { $f = $f + $i }
$a = rands(1,5,5)
$b = rands(1,5,5)
for ($i=0..4) {
$c[$i] = $a[$i]*$b[$i]
}
Conditions can be used inside a for loop, but not outside without explicit blocking
for ($i=1..5) {$a = $a+$i if ($i>2) } WORKS
for ($i=1..5) {$a = $a+$i} if ($a>2) DOES NOT WORK
{for ($i=1..5) {$a = $a+$i} } if ($a>2) WORKS
Note on macros: The descriptions below explain macros available and the arguments the
functions should be called with. Arguments in [square brackets] are optional arguments, and
can be omitted.
Single result randomizers:
- rand(min,max): Returns an integer between min and max
- rrand(min,max,p): Returns an number between min and max in steps of p. Example: rrand(2,5,.1) might return 3.4.
rrand(2,5,.01) might return 3.27. rrand(2,8,2) might return 6
- nonzerorand(min,max): Returns a nonzero integer between min and max
- nonzerorrand(min,max,p): Returns a nonzero real number between min and max in steps of p
- randfrom(list or array): Return an element of the list/array. Examples of lists: "2,4,6,8", or "red,green,blue"
- randname(),randmalename(),randfemalename(): Returns a random first name
Array randomizers (return multiple results):
- rands(min,max,n): Returns n integers between min and max
- rrands(min,max,p,n): Returns n real numbers between min and max in steps of p
- nonzerorands(min,max,n): Returns n nonzero integers between min and max
- nonzerorrands(min,max,p,n): Returns n nonzero real numbers between min and max in steps of p
- randsfrom(list/array,n): Return n elements of the list/array.
- jointrandfrom(list/array,list/array): Returns one element from each list, where the location used in each list is the same
- diffrands(min,max,n): Returns n different integers between min and max
- diffrrands(min,max,p,n): Returns n different real numbers between min and max in steps of p
- diffrandsfrom(list/array,n): Return n different elements of the list/array.
- nonzerodiffrands(min,max,n): Returns n different nonzero integers between min and max
- nonzerodiffrrands(min,max,p,n): Returns n different nonzero real numbers between min and max in steps of p
- jointshuffle(list/array1,list/array2,[n1,n2]): Shuffles two lists/arrays in a way that retains
respective order. In n1 is provided, n1 elements from each shuffled array will be returned (like
a joint version of diffrandsfrom). If n2 is also provided, n1 elements of list/array1 and n2
elements of list/array2 will be returned.
- singleshuffle(list/array,[n]): returns a shuffled version of a list/array. If n is provided,
it behaves identically to diffrandsfrom
- randnames(n),randmalenames(n),randfemalenames(n): Returns n random first names
The following macros help with display:
- makepretty(string or array of strings): Changes double add/subtract signs to a single sign.
- makeprettydisp(string or array of strings): Does makepretty (see above) and backquotes the string for math display
- polymakepretty and polymakeprettydisp: Like makepretty, but for polynomials. Cleans up 0*, 1*, ^1, and ^0 to make the polynomial look nicer.
This function can do weird things for equations that are not simple polynomials, so test well
- makexpretty and makexprettydisp: Like makepretty, but the X-tra version - attempts to clean up things like 1*, 0*, etc. This function
will often cause weird things to happen, so test well
- numtowords(number,[addth]): Creates a string containing number written out in words. Add true as second parameter
to change five to fifth.
- numtoroman(number,[uppercase]): Converts a number 0.5-3999.5 to a roman numeral string. Defaults to uppercase; set second parameter to false to
produce lowercase
- stringappend(value,string): Appends string to value. If value is an array, string is appended to each element of the array
- stringprepend(value,string): Same as stringappend, but prepends string to value
- prettyint(number): Adds commas in thousands spaces of integers. Example: prettyint(1234) will return "1,234". The result is a string, which
can only be used for display, not in calculations
- prettyreal(number,decimals): Adds commas in thousands spaces of number, and rounds decimal to decimals places. Example: prettyreal(1234.567,2) will return "1,234.57". The result is a string, which
can only be used for display, not in calculations
- makescinot(number,[decimals,format]): Converts number to scientific notation. If provided, rounds mantissa to decimals places. Can specify format: "*" "E" as alternative to default cross.
- prettytime(value,informat,outformat): Creates a nice representation of a time. Informat can be 'h', 'm', or 's' designating whether
value is hours, minutes, or seconds. Outformat can be any combination of these to specify output. For example, 'hm' will return "__ hours and __ minutes". Outformat
can also be 'clock' which returns 3:42pm, or 'sclock' which returns 3:42:15pm
- dispreducedfraction(numerator,denominator,[doubleslash]): Takes two numbers as numerator and denominator of a fraction, returning a display form of the fraction,
reduced to lowest terms. Suitable for $showanswer. Set doubleslash to true to produced "3//4" rather than "3/4".
- makereducedfraction(numerator,denominator,[doubleslash]): Same as dispreducefraction, but not already in display form
- decimaltofraction(decimal,[format,maxden]): Converts a decimal to a fraction. Can use format="mixednumber" to get a mixed number rather than improper fraction.
Only works for denominators up to maxden (default 5000)
- showarrays(string,array,[string,array]...,[format]): Creates a tabular display of the data in the array(s) as column(s), with the strings
as column headers. format = "c", "r", or "l" to center, left-align, or right align data. Alternatively you can call this function with arguments
showarrays(array of column headers, array of data arrays, [format]).
- showdataarray(array,[columns]): Creates a tabular display of the data in the array with no headers. Data is presented
in one column unless second argument is provided, in which case the data will be distributed over the specified number of columns.
- horizshowarrays(string,array,[string,array]...): Creates a tabular display of the data in the array(s) as row(s), with the strings
as row labels. Does not text wrap, so only use for small data sets.
- showplot(funcstrings,[xmin,xmax,ymin,ymax,labels,grid,width,height])
- funcstrings is a single string or an array of strings each having at least the first of the following list:
"function,color,min,max,startmarker,endmarker,width,dash"
- Function: a single function of x, like cos(x), or a parametric function of t, entered like [sin(t),cos(t)]
- color: a color designator: black,red,orange,yellow,green,blue,purple
- min,max: the min and max values for the input variable for which you wish to see this graph. You can also exclude
point discontinuities; for example -5,5!0!2 for min,max would include all values from -5 to 5, excluding 0 and 2.
- startmarker,endmarker: can be "open" or "closed" (dots), or anything else for none
- width: a pixel width for the line
- dash: enter "dash" if you want a dashed line, otherwise the line is solid
- Examples: "cos(x),red" or "x^2,,-2,2,open,closed" or "[t^2,t/3],blue,0,5,,,2,dash" or "1/x,black,-5,5!0"
- xmin,xmax,ymin,ymax: Graphing window. Defaults to -5 to 5 for both
- labels: spacing of axes labels. Defaults to 1. Set to "off" or 0 for none. Use "xlbl:ylbl" for different spacing on each axis.
- grid: spacing of grid lines. Defaults to 1. Set to "off" or 0 for none. Use "xgrid:ygrid" for different spacing on each axis.
- width,height: The width and height (in pixels) of the graph. Defaults to 200x200
- addfractionaxislabels(plot,step): Adds labels along the horizontal axis in steps of step to a plot created with showplot.
Step is a fraction like "1/4", or a pi multiple, like "pi/4" or "2pi". When using this, make sure to set the showplot x-axis label
spacing larger than the domain to prevent the default labels from showing.
- addlabel(plot,x,y,label,[color,loc,angle]): Adds a label to a plot created with showplot.
- plot: The plot created with showplot
- x,y: The coordinates for the label
- label: The string label itself. MathML cannot currently be displayed in labels
- color: Label color. Defaults to black.
- loc: By default, the label is centered at the x,y coordinates. Use "left" to display the string to the left of the
point, "right" to the right, "below" for below the point, "above" for above the point.
- angle: Angle to rotate text.
- addlabelabs(plot,x,y,label,[color,loc,angle]): Adds a label to a plot created with showplot. Parameters are the same as with
addlabel, except x and y here are pixel values on the picture rather than values relative to the axes.
- addplotborder(plot,left,[bottom,right,top]): Changes the pixel width of border (default 5) around a plot. Labels
will show within the border. Typically used to add room for labels to show.
- showasciisvg(string,[width,height]): If you know the ASCIIsvg language, this will set up an svg with "string" as the script.
optionally you can specify the width and height (in pixels) for the svg.
- textonimage(img,text,top,left,[text,top,left,...]): Overlays text over an image. Image can be a URL or the variable for an uploaded
image. Specify the text string, and offset in pixels from the top left corner. Can specify multiple strings to overlay.
These macros are fairly general purpose:
- listtoarray(list): Converts a list, like "1,2,3,4" or "cat,dog,rabbit" to an array
- arraytolist(array): Converts an array to a list
- calclisttoarray(list): Converts a list of calculations, like "2^2,3^5,7/2" to an array, evaluating the calculations
along the way.
- stringtoarray(string): Converts a text string to an array of characters
- fillarray(value,num,[start]): Creates an array with num entries, all of which are the same given value. Array indexing
starts at 0 unless specified
- sortarray(list/array,[dir]): Sorts an array from lowest to highest value. To sort in reverse order, give the option
second parameter as "rev"
- consecutive(min,max,[step]): Creates an array of consecutive numbers, starting at min and ending at max, in increments of
step. Step is optional; it defaults to 1.
- calconarray(array,calculation): Returns an array, performing the given calculation on each element of the given array. Use
"x" as the variable to represent each element of the array. Example: $b = calconarray($a,"x^2") will create an array that is the
square each element of the array $a.
- multicalconarray(calculation,varslist,var1array,var2array,etc.) Returns an array, performing the given calculation on each set
of elements from the given arrays. Allows multivariable calculations. Example: $z= multicalconarray("x*y^2","x,y",$xs,$ys)
- calconarrayif(array,calculation,ifcondition): Like calconarray, but allows you to specify a condition for each element for whether to
do the calculation. Example: $b = calconarray($a,"x+.1","floor(x)==x") will add .1 to add whole numbers in the array, and leave the
other elements unchanged.
- subarray(array,params): Creates a new array as a subset of the specified array. The params can take several forms:
- subarray($a,2,4,6): creates an array from $a[2], $a[4], and $a[6]
- subarray($a,"1:3","6:8"): create an array from $a[1] through $a[3], and $a[6] through $a[8]
- subarray($a,$b): creates an array from entries in $a with indexes specified in $b. So if $b = array(2,4,6), this
would return $a[2], $a[4], and $a[6]
- joinarray(array,symbol): Convert an array to a string, joining elements with the given symbol
- mergearrays(array,array): Combines two arrays into one long array
- unionarrays(array,array): Unions two arrays, preventing duplicates, into a new array
- intersectarrays(array,array): Finds the intersection of two arrays
- diffarrays(array1,array2): Returns all elements in array1 that are not also in array2
- count(array): Counts the number of entries in the array
- sumarray(array): Adds the entries in an array
- in_array(needle,haystack): Checks if value needle is in array haystack. Returns true or false
- arrayfindindex(needle,haystack): Returns the index in the array haystack of the value needle. If there are multiple matches, it only returns the first.
- arrayfindindices(needle,haystack): Returns an array of indices in the array haystack of the value needle.
- array_flip(array): Reverses a one-to-one array, so indexes become values and values become indexes
- arraystodoteqns(xarray,yarray,[color]): Converts an array of x-values and y-values into a form that can be used in
showplot.
- arraystodots(xarray,yarray): Converts an array of x-values and y-values into a form that can be used in the Drawing answer type
- today([string]): Returns today's date, like "July 3, 2008". Can change format using string (see http://us2.php.net/manual/en/function.date.php for formats)
- ifthen(condition,trueval,falseval): Takes a comparision condition, and returns the trueval if the condition is true and the falseval otherwise.
These macros are used for mathematical calculations:
- sin(t), cos(t), tan(t), sec(t), csc(t), cot(t): The usual trig functions
- arcsin(v), arccos(v), arctan(v): The inverse trig functions
- abs(v): Absolute value
- gcd(a,b): Greatest common divisor of a and b
- lcm(a,b): Least common multiple of a and b
- v!: Factorial, like $a = $b!
- evalfunc(func,vars,val1,val2,..): Evaluates a function given the variables and values for each variable.
for example evalfunc("x^2*y","x,y",2,3) will evaluate x^2*y with x=2, y=3
If an IMathAS administrator has installed other Macro Libraries, you can load a macro library by entering the line
loadlibrary("list of library names")
at the beginning of the Common Control section.
Examples:
loadlibrary("stats")
or
loadlibrary("stats,misc")
Click on the "Macro Library Help" link in the question editor to get a list of installed macro libraries and the macros
available in each library
IMathAS uses ASCIIMath for math entry. For calculations, a limited subset is available:
Symbol | Meaning |
* / + - | Multiply, divide, add, subtract |
^ | Powers. 2^3 = 8. |
e, pi | The standard constants |
% | Modulus (remainder after division. 5%2 = 1) |
! | Factorial |
sqrt | Square root |
sin,cos,tan,cot,sinh,cosh | Standard trig function. Be sure to enter as sin(2), not sin 2 |
arcsin,arccos,arctan,arcsinh,arccosh | Inverse trig functions. |
sin^-1, cos^-1, tan^-1 | Alternative entry for inverse trig functions. Use like sin^-1(0.5) |
ln | Natural Logarithm base e |
log | Common Logarithm base 10 |
abs | Absolute Value. Note that while abs() is used for calculations, you may prefer to use | brackets for display |
round(n,d) | round number n to d decimal places |
floor,ceil | floor/ceiling: integer below/above given number |
For display only, the full ASCIIMath language is available (which includes support
for a limited subset of LaTeX). For more info, see the
full ASCIIMath syntax, or look at
some examples.
All question types can support these options:
Hints
For a single question (not multipart), to use hints, in the common control (or question control) section define the array $hints where:
$hints[attempt number] = "hint text"
For example:
$hints[0] = "This will show on first display"
$hints[1] = "This will show on second attempt (after 1 missed attempt)"
$hints[2] = "This will show on third and subsequent attempts, since no later values have been defined"
It is fine, or example, to not define $hints[0] if you want nothing to display initially.
Then in the question text, place the location of the hint using the variable $hintloc.
In multipart questions, you can follow the process above if you just want a single strand of hints for the entire problem. If you want per-part hints, define the $hints array as:
$hints[question part number][attempt number] = "hint text"
Then in question text, place each hint using $hintloc[question part number]
Referencing Student Answers
To create multipart questions that are graded on consistency, or to create a set of lab-type problems that rely on student-provided data, you can reference
students' previous answers in your question code. You will only be able to reference the student answer to number and calculated type answers
- $stuanswers[N] will refer to the student's answer on question N (not zero-indexed: N=1 is question 1)
- $stuanswers[N][P] will refer to the student's answer on question N, part P (if multipart)
- $stuanswers[$thisq][P] will refer to the student's answer on the current question, part P
- $stuanswers[$thisq-1] will refer to the student's answer on the previous question
Notes (important!):
1) If the student has not answered the question, then $stuanswers[N] == null. If used in an equation, it will take on the value 0. To prevent divide-by-zero errors and to prevent students from exploiting this, it is highly recommended that you do something like:
$a = $stuanswers[$thisq][0]
$a = rand(1,100) if ($a==null)
Perhaps also include:
$warning = "You MUST answer question 1 before this question" if ($a==null), then put $warning in the question text.
2) If you use $stuanswers in your $answer, $showanswer will generally not be defined. If you follow my advice in #1 above, then your
$showanswer will reflect the random number assigned to $a. For this reason, it is highly recommended that you custom define the $showanswer.
3) If using the $stuanswers array in a string or in the Question Text, you must enclose it with curly brackets:
Your answer was {$stuanswers[0][0]}. If using it directly in a calculation, enclose it in parentheses just to be safe.
4) $stuanswers[$thisq] is only defined for question scoring, not question display, so don't try to use it in question display.
Reusing Code
You can import in the Common Control code from another question using
includecodefrom(questionid)
where questionid is the ID number of the question you want to import the code of. In the
source question, the variable $included will automatically be set to true when the question
has been included, so it can be used to determine if the question has been
imported into another question, or is running independently.
For example, in the master/source question, you might use the code:
if (!$included) {
$type = rand(0,4)
}
do stuff here
In a question using this code, you could limit to a specific type using:
$type = 0
includecodefrom(1234)
Question text can be also brought in from another question by using
includeqtextfrom(questionid)
somewhere in the Question Text portion of the question.
The question types available are:
The student is asked to enter a number (integer, decimal, or scientific notation).
The answer is compared to a given tolerance. Can also accept DNE, oo (Infinity), and
-oo (Negative Infinity) as answers.
Required Variables
- $answer = a number or calculation resulting in a number, like $answer = 5 (In Answer)
- Defines the answer. Define multiple acceptable answers in a string separated by or: $answer = "3 or 5 or 7".
Alternatively, you can provide an interval notation range of
acceptable answers, like $answer = "(2,5]". Providing a range will override any tolerances set. If $answerformat is set
for list answers, then this should provide a list of correct answers, like $answer = "1,2,3".
Optional Variables
- $reltolerance = a decimal value (In Answer)
- Defines the largest relative error that will be accepted. If this is not set, a relative error of .001 (.1%) is
used by default.
- $abstolerance = a number (In Answer)
- Defines the largest absolute error that will be accepted. This will override the use of $reltolerance
- $reqdecimals = a number (In Answer)
- Defines the decimal accuracy required (ie 2 for two decimal places). This will put a message in the answer tips stating the
decimals required. If neither $abstolerance or $reltolerance is set, this will set the tolerance, otherwise the provided tolerance
will be used (even if it doesn't agree with the $reqdecimal setting).
- $answerformat = "list", "exactlist", or "orderedlist"
Specifies that a list of answers is expected. If $answerformat="list", then duplicate values are ignored. If $answerformat="exactlist",
then duplicate values are not ignored. If $answerformat="orderedlist", the list must be in the same order and contain identical counts of values.
- $ansprompt = string (In Question Control)
- A string that will be displayed in front of the input box. Example: $ansprompt="y="
- $displayformat = "point" or "vector" (In Question Control)
- Used in conjunction with $answerformat = "orderedlist"; surrounds the input box with parens (for point) or angle brackets (for vector).
- $answerboxsize = number (In Question Control)
- Determines the number of characters space provided for entry of an answer. Defaults to 20.
- $answerbox (In Question Text)
- Using the variable $answerbox in the Question Text will place the question input box in that location
- $showanswer (In Answer)
- The answer to show to students (if option if available). Defaults to $answer. Use this to give a detailed answer,
or a rounded off answer.
- $hidetips = true (In Question Control)
- Hides the question entry tips that display by default
A student is asked to enter a number or a calculation, like 2/3, 5^2, or sin(2). Can also accept DNE, oo (Infinity), and
-oo (Negative Infinity) as answers.
Required Variables
- $answer = a number or calculation resulting in a number (In Answer)
- Defines the answer. Define multiple acceptable answers in a string separated by or: $answer = "3 or 5 or 7".
Alternatively, you can provide an interval notation range of
acceptable answers, like $answer = "(2,5]". Providing a range will override any tolerances set
Optional Variables
- $answerformat = "fraction", "reducedfraction", "mixednumber", "sloppymixednumber","scinot", "fracordec", "nodecimal", "notrig", "allowmixed", "noval", "list", "exactlist", or "orderedlist" (In Common Control)
- Specifies answer format options. Some can be combined, like this: $answerformat="nodecimal,notrig".
- fraction: requires the answer to be a single fraction (like 10/6, 1/3, or 5)
- reducedfraction: a reduced fraction (like 5/3 or 5)
- mixednumber: a reduced mixed number (like 2 1/2 or 2_1/2, or 2/3 or 5)
- sloppymixednumber: a mixed number (will take 5/2, 2 1/2, even 1 3/2)
- scinot: scientific notation (like 2.3*10^4)
- fracordec: a single fraction or decimal value
- nodecimal: an answer without decimals (also disallows 10^-2 and 3E-2).
- notrig: an answer without trig functions (sin,cos,tan,sec,csc,cot)
- allowmixed: will accept mixed numbers (like 2 1/2) as well as other expressions
- noval: tells the answer preview to not compute a decimal equivalent
- list: a list of answers is expected - ignores duplicate values (1,1,2 is equivalent to 1,2)
- exactlist: a list of answers is expected - does not ignore duplicates
- orderedlist: a list of answers is expected - order is important, and duplicates are not ignored
- $reltolerance = a decimal value (In Answer)
- Defines the largest relative error that will be accepted. If this is not set, a relative error of .001 (.1%) is
used by default.
- $abstolerance = a number (In Answer)
- Defines the largest absolute error that will be accepted. This will override the use of $reltolerance
- $reqdecimals = a number (In Answer)
- Defines the decimal accuracy required (ie 2 for two decimal places). This will put a message in the answer tips stating the
decimals required. If neither $abstolerance or $reltolerance is set, this will set the tolerance, otherwise the provided tolerance
will be used (even if it doesn't agree with the $reqdecimal setting).
- $requiretimes = a list, like "^,=3,cos,<2" (In Answer)
- Adds format checking to the student's answer. The list can include multiple checks, which come in pairs. The
first is the symbol to look for. The second describes what is acceptable. For example, in the string shown above,
the symbol "^" would be required to show up exactly 3 times, and "cos" would be required to show up less than 2 times. You can
use "#" in the symbol location to match any number (including decimal values); 3.2^5 would match twice.
- $ansprompt = string (In Question Control)
- A string that will be displayed in front of the input box. Example: $ansprompt="y="
- $displayformat = "point" or "vector" (In Question Control)
- Used in conjunction with $answerformat = "orderedlist"; surrounds the input box with parens (for point) or angle brackets (for vector).
- $answerboxsize = number (In Question Control)
- Determines the number of characters space provided for entry of an answer. Defaults to 20.
- $hidepreview = true (In Question Control)
- Hides the Preview button. Could be useful in multipart questions, or if you're only asking for a simple
response, like a fraction
- $answerbox (In Question Text)
- Using the variable $answerbox in the Question Text will place the question input box in that location
- $showanswer (In Answer)
- The answer to show to students (if option if available). Defaults to $answer. Use this to give a detailed answer,
or a rounded off answer.
- $previewloc (In Question Text)
- Where you want the preview button to be located. Defaults to after the entry box if not placed in question text.
- $hidetips = true (In Question Control)
- Hides the question entry tips that display by default
A student is asked to select the correct answer from those given. The order
of choices is automatically randomized.
Required Variables
- $questions (or $choices) = an array of choices (In Common Control)
- Defines the choices. If you use $choices, don't define $questions
- $answer = the index into $questions that contains the correct answer (In Answer)
- Defines the answer. Remember that arrays are zero-indexed, so if $questions = array("correct","wrong","wrong"),
then $answer=0. Define multiple acceptable answer indices in a string separated by or: $answer = "0 or 1".
Optional Variables
- $displayformat = "horiz", "select", "2column, "3column", or "inline" (In Question Control)
- Will lay out the choices horizontally, as a select box, in multiple columns, or inline with text rather than using the default vertical layout
- $noshuffle = "all" or "last" (In Common Control)
- If $noshuffle="all", then the $questions array will not be randomized (shuffled). If $noshuffle = "last", then the $questions
array will be randomized, except for the last element. This is for options like "None of the above"
- $answerbox (In Question Text)
- Using the variable $answerbox in the Question Text will place the choice list in that location
- $showanswer (In Answer)
- The answer to show to students (if option if available). Defaults to the text of the correct answer.
Use this to substitute a detailed answer.
- $hidetips = true (In Question Control)
- Hides the question entry tips that display by default
A student is asked to select all the choices given that are correct. The order
of choices is automatically randomized.
Required Variables
- $questions (or $choices)= an array of questions (In Common Control)
- Defines the choices. If you use $choices, don't define $questions
- $answers = a list of the indexes into $questions that contain the correct answer (In Answer)
- Defines the answers. Remember that arrays are zero-indexed, if $questions = array("correct","correct","wrong"),
then $answers="0,1"
Optional Variables
- $scoremethod = "answers" or "allornothing" (In Answer)
- By default, the total points possible are divided by the number of questions, and partial credit is lost for each
correct answer missed and each wrong answer selected. If $scoremethod="answers" is set, then the total points
possible are divided by the number of answers (tougher grading scheme). If $scoremethod="allornothing", then the
student will only get credit if every piece is correct (no partial credit).
- $displayformat = "horiz", "2column, "3column", or "inline" (In Question Control)
- Will lay out the choices horizontally, in multiple columns, or inline with text rather than using the default vertical layout
- $noshuffle = "all" (In Common Control)
- If $noshuffle="all", then the $questions array will not be randomized (shuffled)
- $answerbox (In Question Text)
- Using the variable $answerbox in the Question Text will place the choice list in that location
- $showanswer (In Answer)
- The answer to show to students (if option if available). Defaults to the text of the correct answers.
Use this to substitute a detailed answer.
- $hidetips = true (In Question Control)
- Hides the question entry tips that display by default
A student is asked to match answers with questions
Required Variables
- $questions = an array of questions (In Common Control)
- Defines the questions - these will be on the left with entry boxes
- $answers = an array of answers (In Common Control)
- Defines the answers - these will be on the right and lettered
Optional Variables
- $matchlist = a list of the indexes into $answers that contain the match to each question. (In Answer)
- Defines correct matches. By default, it is assumed that each element of $questions is matched one-to-one with the
corresponding element of $answers (in other words, that $answers[0] is the answer to $questions[0]).
$matchlist allows
you to define one-to-many matches. Example: if $questions=array("cat","dog","quartz") and
$answers=array("animal","mineral"), then $matchlist = "0,0,1"
- $questiontitle = string (In Question Control)
- Displays a title above the list of questions. For example, if $questions was a list of
states, then $questiontitle="States" would be appropriate
- $answertitle = string (In Question Control)
- Displays a title above the list of answers
- $noshuffle = "questions" or "answers"
- Retains original order of questions or answers, and only shuffles the other. By default, both lists are shuffled
- $displayformat = "select" or "2columnselect"
- Only displays the $answers, with select boxes next to each containing the $questions. This should only be used with
pure text $questions.
- $answerbox (In Question Text)
- Using the variable $answerbox in the Question Text will place matching questions and answers in that location
- $showanswer (In Answer)
- The answer to show to students (if option if available). Defaults to the list of correct matches.
Use this to substitute a detailed answer.
- $hidetips = true (In Question Control)
- Hides the question entry tips that display by default
A student is asked to enter a function
Required Variables
- $answer = string (In Answer)
- Defines the answer function, entered as a string. For example, $answer="2sin(x)"
Optional Variables
- $variables = string (In Common Control)
- A list of all variables in the function (including letters representing constants). Defaults to "x"
- $domain = "inputmin,inputmax" (In Common Control)
- Defines the domain on which to compare the given answer and correct answer functions. The same domain
applies to all variables. An option third list element "integers" can be given, which limits the domain to integer
values. The domain defaults to real numbers from -10 to 10. If using multiple variables, can extend domain to
define domain for each variable separately. Example: $variables = "x,y"; $domain = "0,5,20,25"
- $requiretimes = a list, like "^,=3,cos,<2" (In Answer)
- Adds format checking to the student's answer. The list can include multiple checks, which come in pairs. The
first is the symbol to look for. The second describes what is acceptable. For example, in the string shown above,
the symbol "^" would be required to show up exactly 3 times, and "cos" would be required to show up less than 2 times. You can
use "#" in the symbol location to match any number (including decimal values); 3.2x+42y would match twice.
- $answerformat = "equation" or "toconst" (In Common Control)
- By default, the student answer is expected to be an expression, and be equivalent (at points) to the specified answer. This option changes
this behavior.
"equation": Specifies that the answer expected is an equation rather than an expression. The given
answer should also be an equation. Be sure to specify all variables in the equation in $variables. This may fail
on equations that are near zero for most values of the input; this can often be overcome by changing the $domain
"toconst": Specifies that the answer provided by the student is allowed to differ from the specified answer by a constant
for all inputs. Appropriate for comparing antiderivatives. This may fail on expressions that evaluate to very large
values or raise numbers to very large powers.
- $reltolerance = a decimal value (In Answer)
- Defines the largest relative error that will be accepted. If this is not set, a relative error of .001 (.1%) is
used by default.
- $abstolerance = a number (In Answer)
- Defines the largest absolute error that will be accepted. This will override the use of $reltolerance
- $ansprompt = string (In Question Control)
- A string that will be displayed in front of the input box. Example: $ansprompt="y="
- $answerboxsize = number (In Question Control)
- Determines the number of characters space provided for entry of an answer. Defaults to 20.
- $hidepreview = true (In Question Control)
- Hides the Preview button. Could be useful in multipart questions, but generally not recommended
- $answerbox (In Question Text)
- Using the variable $answerbox in the Question Text will place the question input box in that location
- $showanswer (In Answer)
- The answer to show to students (if option if available). Defaults to makeprettydisp($answer).
- $previewloc (In Question Text)
- Where you want the preview button to be located. Defaults to after the entry box if not placed in question text.
- $hidetips = true (In Question Control)
- Hides the question entry tips that display by default
A student is asked to enter a string (a word or list of letters).
Required Variables
- $answer = a string (In Answer)
- Defines the answer. Multiple acceptable answers can be entered using "or". Example: $answer = "dog or cat"
Optional Variables
- $strflags = string of flags, like "ignore_case=1,trim_whitespace=0" (In Answer)
- Determines how the string will be compared. Set to 1 to turn on, 0 for off. Flags are:
- ignore_case: ignores capitol/lowercase differences
- trim_whitespace: trims leading and ending whitespace (spaces)
- compress_whitespace: compresses multiple spaces to one space and trims
- remove_whitespace: removes all whitespace (spaces)
- ignore_order: treats ABC and CBA as equivalent
- ignore_commas: removes commas
- partial_credit: awards partial credit based on Levenshtein distance between strings
- special_or: use *or* for separating answers rather than or.
By default, compress_whitespace and ignore_case are On.
- $ansprompt = string (In Question Control)
- A string that will be displayed in front of the input box. Example: $ansprompt="type: "
- $answerboxsize = number (In Question Control)
- Determines the number of characters space provided for entry of an answer. Defaults to 20.
- $answerbox (In Question Text)
- Using the variable $answerbox in the Question Text will place the answer entry box in that location
- $showanswer (In Answer)
- The answer to show to students (if option if available). Defaults to the text of the correct answer.
Use this to substitute a detailed answer.
- $hidetips = true (In Question Control)
- Hides the question entry tips that display by default
A student is asked to enter a free-response answer.
The essay type is not automatically graded.
Required Variables
None - the essay type is not computer graded.
Optional Variables
- $answerboxsize = "rows" or $answerboxsize = "rows,columns" (In Question Control)
- Determines size of space provided for entry of an answer. Defaults to 5 rows, 50 columns.
- $displayformat = "editor" (In Common Control)
- Use the rich text editor for the essay answer box.
- $answerbox (In Question Text)
- Using the variable $answerbox in the Question Text will place the essay box in that location
- $showanswer (In Answer)
- The answer to show to students (if option if available). Defaults to the text of the correct answer.
Use this to substitute a detailed answer.
- $hidetips = true (In Question Control)
- Hides the question entry tips that display by default
Drawing questions require the student to draw one or more lines/curves or dots.
Dots are graded right/wrong. Lines/curves are graded based on the deviation of the
drawn line from the correct line.
Required Variables
- $answers = a string or array of strings describing the points or curves to be drawn (In Answer)
- Curves: "f(x)" or "f(x),xmin,xmax", like "x^2+3" or "x,-3,2"
Dots: "x,y" for closed dots, "x,y,open" for open dots, like "2,3"
Optional Variables
- $grid = "xmin,xmax,ymin,ymax,xscl,yscl,imagewidth,imageheight" (In Common Control)
- Defines the grid to be drawn on. Defaults to "-5,5,-5,5,1,1,300,300". You can set all or just some of the
values. For example, to just set the window, you could use "0,10,0,10"
- $background = equation or array of equations, using the showplot macro format (In Common Control)
- Define a graph to display in the background, to be drawn on top of. Example: $background = "x^2,red"
- $answerformat = "line,dot,opendot" or "polygon" (In Question Control)
- Limits the drawing tools available to students. Defaults to "line,dot,opendot". Define to limit the options.
Example: $answerformat = "line", or $answerformat = "line,dot"
Can use $answerformat = "polygon" for a single polygon; give $answer as array of points in order joined with edges.
- $partweights = array or list of weights (In Answer)
- Defines grading weight for each line or dot in $answers. Example: $partweights = ".5,.25,.25". Defaults
to equal weights on each line or dot.
- $reltolerance = tolerance scaling factor
- Scales the grading tolerance. Defaults to 1. Set $reltolerance = 2 to make the grading twice as tolerant;
$reltolerance = 0.5 to make grading half as forgiving
- $abstolerance = grading cutoff
- Sets all-or-nothing grading. If score < $abstolerance, the student receives 0 for the question (note: score is
between 0 and 1). Otherwise
the student will receive full credit. Not set by default.
- $answerbox (In Question Text)
- Using the variable $answerbox in the Question Text will place the question input drawing tool in that location
- $showanswer (In Answer)
- The answer to show to students (if option if available). Defaults to the text of the correct answer.
Use this to substitute a detailed answer.
- $hidetips = true (In Question Control)
- Hides the question entry tips that display by default
N-Tuple questions require the student to enter an n-tuple or list of n-tuples.
This can be used for coordinate points, vectors, or any other n-tuple of numbers.
Required Variables
- $answers = a string containing an n-tuple or list of n-tuples (In Answer)
- Defines the answer n-tuple or list of n-tuples. N-tuples can be any dimension,
but must be surrounded by any of: (), [], {}, <>. Examples: $answer = "(1,2)",
$answer = "<2,3,4>,<1,5,7>".
Optional Variables
- $displayformat = "point", "pointlist", "vector", "vectorlist", "list" (In Question Control)
- Changes the answer entry tips (does NOT change how the question is graded). For points,
entry like (2,3) is specified. For vectors, entry like <2,3> is specified.
- $reltolerance = a decimal value (In Answer)
- Defines the largest relative error that will be accepted. If this is not set, a relative error of .001 (.1%) is
used by default.
- $abstolerance = a number (In Answer)
- Defines the largest absolute error that will be accepted. This will override the use of $reltolerance
- $answerbox (In Question Text)
- Using the variable $answerbox in the Question Text will place the question input drawing tool in that location
- $showanswer (In Answer)
- The answer to show to students (if option if available). Defaults to the text of the correct answer.
Use this to substitute a detailed answer.
- $hidetips = true (In Question Control)
- Hides the question entry tips that display by default
Calculated N-Tuple questions require the student to enter an n-tuple or list of n-tuples.
This can be used for coordinate points, vectors, or any other n-tuple of numbers.
Drawing question require the student to draw one or more lines/curves or dots. This
is identical the the N-tuple answer type, but allows students to enter mathematical expressions
rather than just numbers, such as (5/3, 2/3).
Required Variables
- $answers = a string containing an n-tuple or list of n-tuples (In Answer)
- Defines the answer n-tuple or list of n-tuples. N-tuples can be any dimension,
but must be surrounded by any of: (), [], {}, <>. Examples: $answer = "(1,2)",
$answer = "<2,3,4>,<1,5,7>". Note that the instructor specified $answer needs
to be n-tuples of numbers, not calculations.
Optional Variables
- $displayformat = "point", "pointlist", "vector", "vectorlist", "list" (In Question Control)
- Changes the answer entry tips (does NOT change how the question is graded). For points,
entry like (2,3) is specified. For vectors, entry like <2,3> is specified.
- $answerformat = "fraction", "reducedfraction", "mixednumber", "scinot", "fracordec", "nodecimal", or "notrig" (In Common Control)
- Requires each component of the answer to be a single fraction (like 10/6), a reduced fraction (like 5/3), a reduced mixed number (like 2_1/2), scientific notation (like 2.3*10^4), a single fraction or decimal, an answer
without decimals (also disallows 10^-2 and 3E-2), or
an answer without trig functions (sin,cos,tan,sec,csc,cot). Multiple options can be specified like $answerformat="nodecimal,notrig".
- $reltolerance = a decimal value (In Answer)
- Defines the largest relative error that will be accepted. If this is not set, a relative error of .001 (.1%) is
used by default.
- $abstolerance = a number (In Answer)
- Defines the largest absolute error that will be accepted. This will override the use of $reltolerance
- $answerbox (In Question Text)
- Using the variable $answerbox in the Question Text will place the question input drawing tool in that location
- $showanswer (In Answer)
- The answer to show to students (if option if available). Defaults to the text of the correct answer.
Use this to substitute a detailed answer.
- $hidetips = true (In Question Control)
- Hides the question entry tips that display by default
Complex questions require the student to enter a complex number in a+bi form.
Required Variables
- $answers = a string containing a complex number or list of complex numbers (In Answer)
- Defines the answer. Example: $answer="3+2i"
Optional Variables
- $answerformat = "list" (In Common Control)
- Specifies that the answer will be a list of complex numbers.
- $reltolerance = a decimal value (In Answer)
- Defines the largest relative error that will be accepted. If this is not set, a relative error of .001 (.1%) is
used by default.
- $abstolerance = a number (In Answer)
- Defines the largest absolute error that will be accepted. This will override the use of $reltolerance
- $answerbox (In Question Text)
- Using the variable $answerbox in the Question Text will place the question input drawing tool in that location
- $showanswer (In Answer)
- The answer to show to students (if option if available). Defaults to the text of the correct answer.
Use this to substitute a detailed answer.
- $hidetips = true (In Question Control)
- Hides the question entry tips that display by default
Calculated Complex questions require the student to enter a complex number in a+bi form.
This is identical the the N-tuple answer type, but allows students to enter mathematical expressions
rather than just numbers, such as 1/3+sqrt(2)i.
Required Variables
- $answers = a string containing a complex number or list of complex numbers (In Answer)
- Defines the answer. Example: $answer="3+2i"
Optional Variables
- $answerformat = "fraction", "reducedfraction", "mixednumber", "scinot", "fracordec", "nodecimal", or "notrig" (In Common Control)
- Requires the real and imaginary parts of the answer to be a single fraction (like 10/6), a reduced fraction (like 5/3), a reduced mixed number (like 2_1/2), scientific notation (like 2.3*10^4), a single fraction or decimal, an answer
without decimals (also disallows 10^-2 and 3E-2), or
an answer without trig functions (sin,cos,tan,sec,csc,cot). Multiple options can be specified like $answerformat="nodecimal,notrig".
$answerformat = "list" specifies that the answer will be a list of complex numbers.
- $reltolerance = a decimal value (In Answer)
- Defines the largest relative error that will be accepted. If this is not set, a relative error of .001 (.1%) is
used by default.
- $abstolerance = a number (In Answer)
- Defines the largest absolute error that will be accepted. This will override the use of $reltolerance
- $answerbox (In Question Text)
- Using the variable $answerbox in the Question Text will place the question input drawing tool in that location
- $showanswer (In Answer)
- The answer to show to students (if option if available). Defaults to the text of the correct answer.
Use this to substitute a detailed answer.
- $hidetips = true (In Question Control)
- Hides the question entry tips that display by default
The student is asked to enter a matrix of numbers (integer, decimal, or scientific notation).
The entries are compared to a given tolerance.
Required Variables
- $answer = string descripting a matrix of numbers, or calculations leading to numbers (In Answer)
- Defines the answer. Example: $answer = "[(1,2,3),(8/2,5,6)]" is a 2x3 matrix with first row: 1,2,3
Optional Variables
- $answersize = "rows,cols" (In Common Control)
- Defines the size of the answer matrix. If this is supplied, the student will be provided with a grid of
entry boxes in which to input the matrix. If this is not supplied, they will be required to enter the matrix
using the ASCIIMath notation, like "[(1,2,3),(4,5,6)]"
- $reltolerance = a decimal value (In Answer)
- Defines the largest relative error that will be accepted. If this is not set, a relative error of .001 (.1%) is
used by default.
- $abstolerance = a number (In Answer)
- Defines the largest absolute error that will be accepted. This will override the use of $reltolerance
- $ansprompt = string (In Question Control)
- A string that will be displayed in front of the input box. Example: $ansprompt="y="
- $answerboxsize = number (In Question Control)
- Determines the number of characters space provided for entry of an answer. Defaults to 20. Will only be
used if $answersize is not supplied.
- $answerbox (In Question Text)
- Using the variable $answerbox in the Question Text will place the question input box in that location
- $showanswer (In Answer)
- The answer to show to students (if option if available). Defaults to $answer.
Use this to substitute a detailed answer.
- $hidetips = true (In Question Control)
- Hides the question entry tips that display by default
The student is asked to enter a matrix of numbers or calculations, like 2/3 or 5^2.
The entries are compared to a given tolerance.
Required Variables
- $answer = string descripting a matrix of numbers, or calculations leading to numbers (In Answer)
- Defines the answer. Example: $answer = "[(1,2,3),(8/2,5,6)]" is a 2x3 matrix with first row: 1,2,3
Optional Variables
- $answersize = "rows,cols" (In Common Control)
- Defines the size of the answer matrix. If this is supplied, the student will be provided with a grid of
entry boxes in which to input the matrix. If this is not supplied, they will be required to enter the matrix
using the ASCIIMath notation, like "[(1,2,3),(4,5,6)]"
- $answerformat = "fraction", "reducedfraction", "mixednumber", "scinot", "fracordec", "nodecimal", or "notrig" (In Common Control)
- Requires the entries of the answer to be a single fraction (like 10/6), a reduced fraction (like 5/3), a reduced mixed number (like 2_1/2), scientific notation (like 2.3*10^4), a single fraction or decimal, an answer
without decimals (also disallows 10^-2 and 3E-2), or
an answer without trig functions (sin,cos,tan,sec,csc,cot). Multiple options can be specified like $answerformat="nodecimal,notrig".
- $reltolerance = a decimal value (In Answer)
- Defines the largest relative error that will be accepted. If this is not set, a relative error of .001 (.1%) is
used by default.
- $abstolerance = a number (In Answer)
- Defines the largest absolute error that will be accepted. This will override the use of $reltolerance
- $ansprompt = string (In Question Control)
- A string that will be displayed in front of the input box. Example: $ansprompt="y="
- $answerboxsize = number (In Question Control)
- Determines the number of characters space provided for entry of an answer. Defaults to 20. Will only be
used if $answersize is not supplied.
- $hidepreview = true (In Question Control)
- Hides the Preview button. Could be useful in multipart questions, but generally not recommended
- $answerbox (In Question Text)
- Using the variable $answerbox in the Question Text will place the question input box in that location
- $showanswer (In Answer)
- The answer to show to students (if option if available). Defaults to $answer.
Use this to substitute a detailed answer.
- $previewloc (In Question Text)
- Where you want the preview button to be located. Defaults to after the entry box if not placed in question text.
- $hidetips = true (In Question Control)
- Hides the question entry tips that display by default
A student is asked to enter an interval notation answer. Example: (2,5]U(7,oo)
Required Variables
- $answer = a string with the answer in interval notation (In Answer)
- Defines the answer. Join multiple intervals with U for union. Example: $answer = "(-oo,4]U(3,oo)". Use
DNE for empty set. Multiple acceptable answers can be entered using "or". Example: $answer = "(3,3) or [3,3]"
Optional Variables
- $reltolerance = a decimal value (In Answer)
- Defines the largest relative error that will be accepted. If this is not set, a relative error of .001 (.1%) is
used by default.
- $abstolerance = a number (In Answer)
- Defines the largest absolute error that will be accepted. This will override the use of $reltolerance
- $reqdecimals = a number (In Answer)
- Defines the decimal accuracy required (ie 2 for two decimal places). This will put a message in the answer tips stating the
decimals required. If neither $abstolerance or $reltolerance is set, this will set the tolerance, otherwise the provided tolerance
will be used (even if it doesn't agree with the $reqdecimal setting).
- $ansprompt = string (In Question Control)
- A string that will be displayed in front of the input box. Example: $ansprompt="`x in`"
- $answerboxsize = number (In Question Control)
- Determines the number of characters space provided for entry of an answer. Defaults to 20.
- $answerbox (In Question Text)
- Using the variable $answerbox in the Question Text will place the entry box in that location
- $showanswer (In Answer)
- The answer to show to students (if option if available). Defaults to the text of the correct answer.
Use this to substitute a detailed answer.
- $hidetips = true (In Question Control)
- Hides the question entry tips that display by default
A student is asked to enter an interval notation answer. Example: (2,5]U(7,oo). Values can be entered as calculations
rather than numbers, like [2/5,sqrt(8)].
Required Variables
- $answer = a string with the answer in interval notation (In Answer)
- Defines the answer. Join multiple intervals with U for union. Example: $answer = "(-oo,4]U(3,oo)". Use
DNE for empty set. Multiple acceptable answers can be entered using "or". Example: $answer = "(3,3) or [3,3]"
Optional Variables
- $answerformat = "fraction", "reducedfraction", "mixednumber", "scinot", "fracordec", "nodecimal", or "notrig" (In Common Control)
- Requires the each value in the answer to be a single fraction (like 10/6), a reduced fraction (like 5/3), a reduced mixed number (like 2_1/2), scientific notation (like 2.3*10^4), a single fraction or decimal, an answer
without decimals (also disallows 10^-2 and 3E-2), or
an answer without trig functions (sin,cos,tan,sec,csc,cot). Multiple options can be specified like $answerformat="nodecimal,notrig".
- $reltolerance = a decimal value (In Answer)
- Defines the largest relative error that will be accepted. If this is not set, a relative error of .001 (.1%) is
used by default.
- $abstolerance = a number (In Answer)
- Defines the largest absolute error that will be accepted. This will override the use of $reltolerance
- $reqdecimals = a number (In Answer)
- Defines the decimal accuracy required (ie 2 for two decimal places). This will put a message in the answer tips stating the
decimals required. If neither $abstolerance or $reltolerance is set, this will set the tolerance, otherwise the provided tolerance
will be used (even if it doesn't agree with the $reqdecimal setting).
- $ansprompt = string (In Question Control)
- A string that will be displayed in front of the input box. Example: $ansprompt="`x in`"
- $answerboxsize = number (In Question Control)
- Determines the number of characters space provided for entry of an answer. Defaults to 20.
- $answerbox (In Question Text)
- Using the variable $answerbox in the Question Text will place the entry box in that location
- $showanswer (In Answer)
- The answer to show to students (if option if available). Defaults to the text of the correct answer.
Use this to substitute a detailed answer.
- $previewloc (In Question Text)
- Where you want the preview button to be located. Defaults to after the entry box if not placed in question text.
- $hidetips = true (In Question Control)
- Hides the question entry tips that display by default
A student is asked to upload a file.
The file upload type is not automatically graded.
Required Variables
None - the file upload type is not computer graded.
Optional Variables
- $answerbox (In Question Text)
- Using the variable $answerbox in the Question Text will place the file upload box in that location
- $showanswer (In Answer)
- The answer to show to students (if option if available).
- $hidetips = true (In Question Control)
- Hides the question entry tips that display by default
This type of question can contain multiple parts, where each part is one of the previous question types.
Required Variables
- $anstypes = an array or list of answer types (In Answer)
- Defines the answer type for each part. Example:
$anstypes = array("number","number","choices")
Refer to this list for the short names of each question type:
- Number: "number"
- Calculated: "calculated"
- Multiple Choice: "choices"
- Multiple Answer: "multans"
- Matching: "matching"
- Function/expression: "numfunc"
- Drawing: "draw"
- N-tuple: "ntuple"
- Calculated N-tuple: "calcntuple"
- Matrix: "matrix"
- Calculated Matrix: "calcmatrix"
- Complex: "complex"
- Calculated Complex: "calccomplex"
- Interval: "interval"
- Calculated Interval: "calcinterval"
- Essay: "essay"
- File Upload: "file"
- String: "string"
- Question part variables
- For each question part, you will need to define the variables (like $answer, $questions, etc.) you would normally
need to define. However, you will need to suffix the variable with a part designator. For example, based on $anstypes
above, the first answer is a number. Instead of $answer = 5, enter $answer[0] = 5. This designates that this answer belongs
to the first element of $anstypes. Likewise, to set the variables for the "numfunc" type, you'd set $variables[5] = "x".
- $answerbox[partnum] (In Question Text)
- The array $answerbox will contain the entry boxes for each answer type. In the question text, you will need to position
these boxes within the question. For example: "Enter a number: $answerbox[0]. Now a function: $answerbox[5]"
Optional Variables
- $answeights = an array or list of weights for each question (In Answer)
- By default the points for a problem are divided evenly over the parts. Use this option if you wish to weight parts
differently. Weights should be percentages (in decimal form), and add to 1. Example: $answeights = array(.2,.3,.5)
- Question part options
- You can define any optional variable for each question part. Like above, suffix the variable with the part designator.
- $showanswer (In Answer)
- You can either define $showanswer for individual question parts (ie, $showanswer[1]="`x^2`"), or you can set one
$showanswer, which will be the only answer shown for the problem (ie, $showanswer = "x=$answer[0], y=$answer[1]")