Grading a list of numbers

  • Maple TA Interns 2016

    We often want to be able to write a question that accepts a list of numbers. The easiest way I've found to do this is using a maple-graded response area. A comma-separated sequence of numbers, e.g. "1, 0, -1" (without quotes) is called an expression sequence in Maple. An expression sequence can be used to initialise a list or set. For examples, if the student enters "1, 2, 3" (without quotes) into the response area, then {$RESPONSE} = {1, 2, 3}.

    1. Create a new Maple-graded response area
    2. Set Expression Type: to Maple Syntax, and set Text/Symbolic entry: to Text entry only
    3. Then in Answer enter, for example, "{-1, 0, 1}", without quotes
    4. Then in Grading Code: enter: "evalb($ANSWER={$RESPONSE})", without quotes. This will convert the student's comma-separated sequence into a set of numbers, and compare it to $ANSWER

    The reason we use sets rather than lists is that sets are unordered, so the student can enter "0, 1, -1" (without quotes) and it will be marked as correct.

  • administrators

    Note that sets discard duplicate values, which may be important for questions such as roots of polynomials where the correct answer could be 1,2,2 and the duplicate 2 should matter.

    In this case, use a list instead of a set and ask the student to enter their answers in a particular order, such as lowest-highest.

    Answer would then be [1,2,2]

    Grading Code would then be evalb($ANSWER=[$RESPONSE])

  • Maple TA Interns 2016

    You can also use 'Mathematical Formula' - 'unordered list of formulas' instead of the Maple-graded response area to accept a list of unordered numbers separated by semi-colons.