Author a formula (Maple-graded) sub-type

The Maple-graded formula question sub-type is one of the two sub-types of the Maple-graded question.

This sub-type is authored by inserting a Maple-graded response area.

TIP: Check out Author a Maple-graded question for full instructions on the Maple-graded response area.

With the formula (Maple-graded) sub-type:

  • Students can't enter Maple commands as their answer for this question sub-type.
  • Students can choose whether they want to use text entry mode or symbolic entry mode for entering their response.

Whether the student submits a response to a formula (Maple-graded) sub-type question using text or symbolic entry, Möbius parses their algebraic expressions into proper Maple syntax so that the Maple engine can apply your Maple grading code.

A formula (Maple-graded) sub-type question can't recognize function notation unless the function is listed on Function and operator syntax (Examplesin(x+1) is the sine trigonometric function but f(x+1) is converted to f*(x+1)).

TIP:Check out Author a Maple syntax sub-type for examples where other functions are supported, or check out Choose a Maple-graded question sub-type for a comparison of the two Maple-graded question sub-types.

TIP: Existing knowledge of the Maple language will help you to author Maple-graded questions. Check out Maple syntax from the Maple online help site.

TIP: Check out View example Maple grading code for help with authoring custom grading code for your Maple-graded questions.

TIP: To allow students to be marked correct for entering exp(x) or e^x, be sure to author your Maple-graded question as a formula sub-type. You'll then use the following grading code:

Copy this code
evalb(simplify(($ANSWER)-($RESPONSE))=0);

The Maple syntax sub-type won't accept both of these answers since only responses in Maple form are accepted.

Example: Algorithm

This example includes an algorithmic matrix with the default grading code.

  • Question statement:

Calculate the determinant of $m.

  • Algorithm:
Copy this code
$n=int(rand(2,4));
$matrix=maple("randomize(): LinearAlgebra[RandomMatrix]($n,$n,generator=rand(-9..10))");
$m=maple("printf(MathML[ExportPresentation]($matrix))");

  • Answer field syntax:
Copy this code
LinearAlgebra[Determinant]($matrix);

  • Grading code syntax:
Copy this code
evalb(($ANSWER)-($RESPONSE)=0);

NOTE: This is the default grading code.

  • Expression type:
  • Formula

  • Text/Symbolic entry:
  • Student can choose

NOTE: This option is selected by default and can't be changed with the formula (Maple-graded) sub-type.

Example: Plotting code and infinite number of correct responses

This example accepts an infinite number of correct answers using the Maple grading code so that you don't need to define an explicit list of correct answers.

The Maple grading code uses the verify command, and plotting code is defined for students to visualize their response on a plot.

  • Question statement:

Give an example of a function f(x) that is increasing on the interval [0,1].

Click Plot to verify that your function increases.

f(x) =

  • Answer field syntax:

No answer field value required.

NOTE: This example shows that a value isn't always required in this field, especially since there are an infinite number of correct answers.

  • Grading code syntax:
Copy this code
assume(x >=0, x <= 1);
verify(diff($RESPONSE, x), 0, {'greater_equal'});

  • Expression type:
  • Formula

  • Text/Symbolic entry:
  • Student can choose

NOTE: This option is selected by default and can't be changed with the formula (Maple-graded) sub-type.

  • Plotting code syntax:
Copy this code
plot($RESPONSE, x=0..1);

NOTE: When plotting code is defined, the student will be able to click the Plot iconassociated with the response area for a preview of their plotted response.

Example: Approximation of exact symbolic answers

This example randomly generates the radius $r of the circle and grades a student's response as correct if it's within 5% of the correct answer.

The Maple grading code will accept either the exact symbolic expression 2πr or any numeric response that is within 5% of 2πr evaluated to four significant digits.

NOTE: This example isn't performing grading based on the student entering the specified number of significant digits, but that can be done through additional Maple grading code.

  • Question statement:

Find the circumference of the circle with radius $r correct to four significant digits.

  • Algorithm:
Copy this code
$r=range(2, 5);

  • Answer field syntax:
Copy this code
exact:= 2*Pi*($r): evalf( exact, 4 );

  • Grading code syntax:
Copy this code
evalb( abs( evalf( $RESPONSE - $ANSWER ) / $ANSWER ) < .05 );

  • Expression type:
  • Formula

  • Text/Symbolic entry:
  • Student can choose

NOTE: This option is selected by default and can't be changed with the formula (Maple-graded) sub-type.

Example: Custom previewing code

This example uses custom previewing code to ensure that when the student previews their response, it's maintained in its unsimplified form.

  • Question statement:

What is 3/8 + 1/8? (Do not simplify your answer)

  • Answer field syntax:
Copy this code
printf(InertForm:-ToMathML(`%/`(4,8)));

NOTE: In this example, the Answer field syntax is defined for display purposes and isn’t used in the grading code syntax.

  • Grading code syntax:
Copy this code
evalb(`%/`(4,8) = InertForm:-Parse("$RESPONSE"));

  • Expression type:
  • Formula

  • Text/Symbolic entry:
  • Student can choose

NOTE: This option is selected by default and can't be changed with the formula (Maple-graded) sub-type.

  • Custom Previewing Code:
Copy this code
printf(InertForm:-ToMathML(InertForm:-Parse("$RESPONSE")));

NOTE: This custom previewing code prevents the student's response from being simplified when they click the Preview icon to preview their response.