5.8 Maple-graded Questions
The Maple-graded question type uses the Maple computer algebra system to generate algorithmic variables in questions, plots, and evaluate student responses. The Maple-graded question type gives you access to the computational power of Maple. It includes facilities for algebra, calculus, differential equations, discrete mathematics, graphics, numerical computation, and many other areas of mathematics.
See Also:
Question Designer
Adaptive Questions in Question Designer
Maple-graded Question Type - Overview
The Maple-graded question type uses the Maple computer algebra system to generate algorithmic variables in questions, generate plots and evaluate student responses. The Maple-graded question type gives you access to the computational power and plotting capabilities of Maple. It includes facilities for algebra, calculus, differential equations, discrete mathematics, graphics, numerical computation, and many other areas of mathematics. Using the Maple-graded question type you have access to many different kinds of mathematical objects, not just simple expressions. You can use Maple to create questions whose responses require sets, differential equations, unevaluated integrals, groups and many other types of mathematical data. Moreover, you can use functions and routines that are contained in a separate Maple Repository (Maple Library). You can access your personal Maple library archives from within your Maple questions.
Since the Maple engine is used when grading student's responses, Maple T.A. will give credit for any response that is mathematically equivalent to the correct answer. You can also assign partial grades, allowing you to find common errors and reward partial credit.
Maple-graded Formula & Maple Syntax Subtypes
The Maple-graded question type has two subtypes:
Both the Maple-graded Formula and Maple Syntax subtypes allow you to use Maple functions and expressions, for example, trigonometric functions, log10, ln, abs, sqrt, diff, int, and LinearAlgebra[Determinant]. In addition to the full range of Maple functions, you can use programming constructs to evaluate responses.
Difference Between Maple Formula and Formula Question Types
Formula questions are very useful when the correct response is a straightforward mathematical expression using standard common functions, and when the correct answer is easy to describe and easy to evaluate.
The Maple-graded Formula subtype differs from the Formula question type.
- When writing a Maple-graded Formula question, you can use Maple functions and expressions in the evaluation of the student response.
- When writing a Formula question type, you cannot use Maple code in the evaluation of the student response.
Viewing your source code reveals that for Maple-graded questions (both Maple Formula and Maple Syntax subtypes) mode=Maple@, while for Formula question types mode=formula@.
Difference Between Maple-graded Formula and Maple Syntax with Text Entry Mode in Student Response
These two subtypes are distinguished by a student's response.
- A student should not use Maple commands and expressions in a response to a question generated using Maple-graded Formula. For details, see Maple-graded Formula. The student responds using other Maple T.A. formula question syntax.
- A student is required to use Maple commands and expressions in a response to a question generated using Maple Syntax with the Text entry response option. For details, see Maple Syntax.
Difference Between Maple-graded Formula and Maple Syntax with Text Entry Mode in Syntax Checking
These two subtypes are distinguished by syntax checking of the student response.
- The system verifies the syntax of a student response for a Maple-graded Formula question using a basic syntax checker. For details, see Maple-graded Formula.
- The system does not verify the syntax of a student response for a Maple Syntax question. As the author, you can verify whether the student is using a Maple command to calculate the answer. For details, see Maple Syntax.
Difference Between Text Entry and Symbolic Entry for Student Response in Maple Syntax Questions
With a Maple Syntax question, you can choose whether the students enter responses using Text mode or Symbol mode. In both cases, the response is sent to Maple, where you can apply sophisticated grading methods to evaluate the student response.
- A student can enter math expressions, including Matrices, in a natural way using Symbol mode. For example, a student can enter a Matrix using a palette.
- A student is required to use Maple commands and expressions in a response to a question generated using Maple Syntax with the Text entry response option.
For details, see Maple Syntax.
Guidelines for Using Maple Code for Maple-graded Questions
- A Maple-graded question must use valid Maple code to evaluate the answer. Complete each line of code with a semicolon.
- The last line of your question code must evaluate to a Boolean value (true or false) or a floating-point number between 0.0 and 1.1 for partial grading. In many cases, it is recommended that you use the Maple evalb command.
- Use the long form name for all package functions, for example, VectorCalculus[ArcLength].
For an example that uses partial grading, see Applying Partial Grading to Maple-graded Questions.
- The student should not use Maple commands in the response. For an explanation, see Syntax and Student Responses below.
- The instructor must write code such that the student does not have to use a trailing semicolon in the response.
For example, evalb($RESPONSE=factor(x^2-1)); as a single line of code allows the student to respond with (x+1)(x-1) omitting the trailing semicolon. This is especially important, as questions created using the Maple-graded Formula question subtype are not obvious Maple questions from the student's perspective. A non-Maple student user can answer a Maple-graded Formula question type without knowing Maple syntax.
Maple T.A. verifies the student response using a basic syntax checker.
- If the answer is entered in Text mode, the formula syntax checker assesses the response, changes expressions to Maple syntax, for example, 2x becomes 2*x, and reports errors if the expression is not a formula. It then generates a Maple statement.
- If the answer is created using the Equation Editor (), a MathML expression is parsed, the syntax checker is run to ensure the answer is of type formula, and then a Maple statement is generated.
You do not need to explicitly check that the student response is a formula. For example, you do not need to check whether factor(expr)is a command that calculates the expression for the student. However, a student response like factor(x^2-1) would be interpreted as implicit multiplication and converted to f*a*c*t*o*r*(x^2-1). As such, the student response will be marked as wrong.
You may need to write Maple code for responses that are interpreted as formulas by Maple T.A., but are Maple commands. For example, if you ask for the value of sin(Pi/4), you must use code to ensure that the student does not simply enter sin(Pi/4), which the Maple T.A. syntax checker accepts and passes to Maple. The correct response is, for example, sqrt(2)/2, which is also a Maple T.A. formula and a Maple command.
The variable e should not be assigned as a global variable in Maple code. It can be used, however, as a local variable.
Maple Syntax is a subtype of the Maple-graded question type.
In this subtype, the student is required to: UsingtheCommentFieldinaMapleQuestion
- Respond using Maple commands and expressions
- Enter syntactically correct Maple expressions
In a Maple Syntax question, you must specify whether the response area is a text-entry area or a symbolic-entry area.
Maple Syntax with Text Entry Response Option
qu.x.y.mode=Maple@
type=maple@
allow2d=0
Student Use of Unevaluated Forms of Maple Commands
Some Maple commands take unevaluated forms. For example, Diff is the inert form of diff. In Maple T.A., students are directed to answer questions using the unevaluated forms of Maple commands. Your code should accept these forms.
The instructor should specify to the student (in the question text) whether a trailing semicolon is required, or alternatively, write code such that the presence or absence of a trailing semicolon has no bearing on the evaluation of the response.
For example, evalb($RESPONSE=factor(x^2-1); as one line of question code does not allow a student response with a semicolon, such as (x-1)*(x+1); The response is marked as incorrect.
If the question code contains two lines, completed with semicolons, such as:
A:= $RESPONSE;
evalb(A=factor(x^2-1);
the student can answer with or without a semicolon and the response is marked as correct.
Maple T.A. does not check the syntax of the student response.
- If the answer is entered in Text mode, it is sent directly to Maple for parsing. The student is expected to enter syntactically correct Maple expressions. Shortcuts such as 2x are marked incorrect.
As the author, you can verify whether the student is using a Maple command to calculate the answer. For more information, see Using Maple Code to Prevent Cheating in Maple Syntax Questions.
Maple Syntax with Symbolic Entry Response Option
qu.x.y.mode=Maple@
type=maple@
allow2d=2
Maple T.A. parses the student response entered in Symbol mode to convert the entered expression into Maple syntax, which is sent to Maple.
Note that, since a translation of the symbolic entry into a Maple Input expression takes place, the technique of using “$RESPONSE” to check whether students entered a specific command may not be appropriate. This technique is only recommended for Maple Syntax questions with the Text entry response option.
The variable e should not be assigned as a global variable in Maple code. It can be used, however, as a local variable.
The Maple-graded question type allows for questions with complicated answers, questions with different possible answers, and questions requiring a powerful answer-equivalence checker. You can also modify them to allow for grading between 0.0 and 1.0 for partial credit.
Note: Grading must be done using a floating-point number. Rational numbers are not accepted. Table 5.4 shows a simple application of the partial credit feature.
Table 5.4: Maple-graded Question with Partial Credit
Text for the question | Solve for x in the following equation: 3x+6=12 |
Maple code that evaluates to the correct answer | solve(3*x+6=12,x); |
Maple code to grade the student response | if ($RESPONSE=6) then 0.5 else evalb($RESPONSE-$ANSWER=0) end if; |
To create a Maple-graded question:
- From the Class Homepage, click Content Repository in the top menu.
- From the Create New drop-down menu, select Question/Text.
- The Question Designer screen appears:
- Enter a title for the question under the Question Name panel.
- Enter the question in the Question Text. To include complicated mathematical expressions, click the Equation Editor icon () in the toolbar.
- Click Response Area ().
- Under Choose Question Type, select Maple-graded.
- On the Edit Response Area screen,
- Weighting: specify the weight of this response area in the overall question. The default Weighting is set to 1.
- In the Answer field, you must enter the correct response to the question. Keep in mind the following details:
- The last line of code must evaluate to an expression that is stored to the variable $ANSWER.
- Complete each line of code with a semicolon.
- Add parentheses when appropriate, for example, (x + y) / 2.
- Use the long form name for all package functions, for example, VectorCalculus[ArcLength].
- A Maple-graded question must use valid Maple code to evaluate the answer. For example, if the question is find the indefinite integral of sin(x), then the Answer field must contain the Maple code int(sin(x),x);
- In the Grading Code region,
- A Maple-graded question must use valid Maple code to evaluate the answer.
- The last line of your question code must evaluate to a Boolean value (true or false) or a floating-point number between 0.0 and 1.0 for partial grading. By default, use the Maple command evalb(($ANSWER)-($RESPONSE)=0); as indicated, where $RESPONSE represents the student response and $ANSWER represents the correct answer.
- If you choose to alter the default grading syntax, complete each line of code with a semicolon.
- Use the long form name for all package functions, for example, VectorCalculus[ArcLength].
- Use $RESPONSE to represent the student response in your code. Before your code is processed by Maple, $RESPONSE is replaced by the student response.
- Use $ANSWER to represent the correct answer, as you have provided in the previous field.
- From the drop-down menu, select an Expression Type: Formula or Maple Syntax. To learn about the differences between Formula and Maple Syntax expression types, see Maple-graded Question Type - Overview.
- If you selected Maple syntax, from the Text/Symbolic entry field, select Text entry only if you want students to type their response in a text region, or Symbolic entry only if you want students to use the Equation Editor to enter their response. For more information on this option and the advantages of each entry mode, see Maple-graded Question Type - Overview.
- (Optional) Enter Plotting Code to enable plotting of the student response. Use $RESPONSE to represent the student response in your code. Before your code is processed by Maple, $RESPONSE is replaced by the student response. The last line must be a Maple plot command. For example, for a student response in the variable x, you might use the following Maple plotting code: plot($RESPONSE, x=0..10);
- (Optional) Enter Custom Previewing Code to change how a student's response is displayed when they choose to preview it. Before your code is processed by Maple, $RESPONSE is replaced by the student response.
Note: You can copy content from a Maple worksheet or a Maple code text file to be used in a Maple-graded question, see Copying Content from Maple.
- Click Save to save the question.
For more information on Maple code, refer to your Maple system documentation.
For specific examples using the Maple-graded question type, see the examples provided: Maple-graded Example 1A:Formula.
Copying Content from the Maple Worksheet to Maple T.A.
- From a Maple worksheet, select the code to be copied.
- From the Maple menu, select Copy.
- In Maple T.A., right-click (Control-click on Mac^{®}) and paste the contents into the appropriate box.
- Rename the response value to $RESPONSE.
- Add $ to all algorithmic variables.
Example 1A: Maple-graded, Formula
- From the Class Homepage, click the Content Repository.
- From the Create New drop-down menu, select Question/Text.
- On the Edit Response Area screen,
- Enter the following for Question Name: Differentiation - Product Rule
- Enter the following for Question Text: Differentiate with respect to
- Click Response Area ().
- Under Choose Question Type, select Maple-graded.
- Weighting: specify the weight of this response area in the overall question. (By default, the Weighting is set to 1).
- Enter the following for the Answer: diff(sin(x)*x,x);
- By default, the following Grading Code is provided: evalb(($ANSWER)-($RESPONSE)=0);
Important: Do not change the default Grading Code: $RESPONSE is a system variable that corresponds to the response the student entered, and $ANSWER refers to the correct answer entered in step 5.
- Ensure that the Expression Type is Formula.
- Select Student can choose for Text/Symbolic entry.
- Click OK to save and end the question authoring process, or Preview to view the question, as shown in Figure 5.24.
Example 1B: Maple-graded, Formula and Plotting
Note: This question is a modification of Maple-graded Example 1A:Formula
- On the Question Designer screen, double-click the Maple response area.
- We are going to plot the student's response, as well as the correct derivative. If the student is correct, the plot region will display a plot with a single curve.
- Enter the following for Plotting Code: plot([$RESPONSE, diff(sin(x)*x,x)],x=-10..10);
- Click Save to save the question.
- Then, click Preview to view the question.
- Enter sin(x) in the student response area.
- Click the Plot icon () next to the student response area, to see: Figure 5.25.
Example 2: Maple-graded, Maple Syntax Option
- From the Class Homepage, click Content Repository in the top menu.
- From the Create New drop-down menu, select Question/Text.
- On the Edit Response Area screen,
- Enter the following for Question Name: Intersection
- Enter the following for Question Text: What is the intersection of the sets Enclose your response in braces, ({}).
- Click Response Area ().
- Under Choose Question Type, select Maple-graded.
- Weighting: specify the weight of this response area in the overall question. (By default, the Weighting is set to 1).
- In the Answer field, enter {b,c}.
- Enter the following for Grading Code: evalb($RESPONSE={a,b,c} intersect {b,c,d,e});
- Ensure that the Expression Type is Maple syntax.
- Under Text/Symbolic entry, choose Text entry only.
- Click Save to save the question, or Preview to view it, as shown in Figure 5.26.
Example 3: Designing a Maple-graded Question to Accept Mathematically Equivalent Responses
This example will create a question that asks for . It should accept ,, or anything equivalent as correct.
- From the Class Homepage, click Content Repository in the top menu.
- From the Create New drop-down menu, select Question/Text.
- On the Edit Response Area screen,
- Enter the following for Question Name: Derivative of Secant.
- Enter the following for Question Text: Compute the derivative of
- Click Response Area ().
- Under Choose Question Type, select Maple-graded
- Weighting: specify the weight of this response area in the overall question. (By default, the Weighting is set to 1).
- Enter the following for the Answer: diff(sec(x),x);
- Enter the following for Grading Code: evalb(simplify(($ANSWER)-($RESPONSE))=0);
Important: The default grading code, evalb(($ANSWER)-($RESPONSE)=0;, would only give credit for and reject all other responses. This is because the evalb command does not perform simplification. It is strongly recommended that you test your Maple code in a Maple worksheet for any Maple-graded questions.
- Ensure that the Expression Type is Formula.
- Under Text/Symbolic entry, choose Student can choose.
- Click Save to save the question, or Preview to view it, as shown in Figure 5.27.
Example 4: Maple-graded, Determinant of a Matrix
This example will create a question that generates a random matrix and asks students to find the determinant.
- From the Class Homepage, click Content Repository in the top menu.
- From the Create New drop-down menu, select Question/Text.
- On the Edit Response Area screen,
- Enter the following for Question Name: Determinant.
- Enter the following for Question Text: Calculate the determinant of $m.
- At the bottom of the page, click the add icon () and enter the following Algorithm:
$n=int(rand(2,4));
$matrix=maple("randomize(): LinearAlgebra[RandomMatrix]($n,$n,generator=rand(-9..10))");
$m=maple("printf(MathML[ExportPresentation]($matrix))");
Note: For more details on adding an Algorithm, see Adding and Editing Algorithms.
- Click Refresh algorithm preview to preview the variables you defined, as shown in Figure 5.28.
- Click Response Area ().
- Under Choose Question Type, select Maple-graded.
- Weighting: specify the weight of this response area in the overall question. (By default, the Weighting is set to 1).
- Enter the following for the Answer: LinearAlgebra[Determinant]($matrix);
- Do not change the default Grading Code. The following default Grading Code is provided: evalb(($ANSWER)-($RESPONSE)=0);
- Ensure that the Expression Type is Formula.
- Under Text/Symbolic entry, choose Student can choose.
- Click Save to save the question, or Preview to view it, as shown in Figure 5.29.
Example 5: Maple-graded, Coefficient Matrix
This example will create a question that asks for the coefficient matrix of a linear system of equations. Students will use the Equation Editor to construct their response.
- From the Class Homepage, click Content Repository in the top menu.
- From the Create New drop-down menu, select Question/Text.
- On the Edit Response Area screen,
- Enter the following for Question Name: Coefficient matrix.
- Enter the following for Question Text:
Give the coefficient matrix of the following system:
To enter the system of equations, click the Equation Editor () icon in the toolbar, and enter the expressions.
- At the bottom of the page, click the add icon () and enter the following Algorithm:
$ans=maple("Matrix([[1,2,-3],[7,-1,2]])");
Note: For more details on adding an Algorithm, see Adding and Editing Algorithms.
- Click Refresh algorithm preview to preview the variables you defined, as shown in Figure 5.30.
- Click Response Area ().
- Under Choose Question Type, select Maple-graded.
- Weighting: specify the weight of this response area in the overall question. (By default, the Weighting is set to 1).
- Enter the following for the Answer: printf(MathML[ExportPresentation]($ans));
Note: This generates MathML for the matrix, presenting it in a nice format for students. For the purpose of grading the student response, however, you must use the variable, not the MathML expression.
- Enter the following for Grading Code: LinearAlgebra[Equal]($RESPONSE,$ans);
Important: The default Grading Code, evalb(($ans)-($RESPONSE)=0);, is not sufficient when working with matrices. To check for matrix equality, use the command: LinearAlgebra[Equal].
- Ensure that the Expression Type is Maple syntax.
- Under Text/Symbolic entry, choose Symbolic entry only.
- Click Save to save the question, or Preview to view it, as shown in Figure 5.31.
Example 6: Maple-graded, Matrix Question with Infinitely Many Correct Responses
This example describes how to create a question that asks for an invertible matrix. The grading of the student response checks whether the determinant of the student's matrix is non-zero.
- From the Class Homepage, click Content Repository in the top menu.
- From the Create New drop-down menu, select Question/Text.
- On the Edit Response Area screen,
- Enter the following for Question Name: Invertible Matrix.
- Enter the following for Question Text: Give an invertible matrix.
- Click Response Area ().
- Under Choose Question Type, select Maple-graded.
- Weighting: specify the weight of this response area in the overall question. (By default, the Weighting is set to 1).
- Enter the following for the Answer:
M:=Matrix([[1,2],[3,4]]):
printf(MathML[ExportPresentation](M));
- Enter the following for Grading Code:
x:=LinearAlgebra[Determinant]($RESPONSE):
evalb(type(x,numeric) and x<>0);
- Ensure that the Expression Type is Matrix Syntax.
- Under Text/Symbolic entry, choose Symbolic entry only.
- Click Save to save the question, or Preview to view it, as shown in Figure 5.32.
See Also:
Maple-graded Question Type - Overview
Mathematical Functions & Operations
Editing with the Equation Editor
Plotting a Student Response
Example 7: Maple-graded, Using the InertForm Package to Avoid Simplification
- From the Class Homepage, click Content Repository in the top menu.
- From the Create New drop-down menu, select Question/Text.
- On the Edit Response Area screen,
- Enter the following for Question Name: Fraction Addition (without simplification)
- Enter the following for Question Text: What is 3/8 + 1/8? (Do not simplify)
- Click Response Area ().
- Under Choose Question Type, select Maple-graded.
- Weighting: specify the weight of this response area in the overall question. (By default, the Weighting is set to 1).
- In the Answer field, enter 4/8.
- Enter the following for Grading Code: evalb(`%/`(4,8) = InertForm:-Parse("$RESPONSE"));
- From the Expression Type drop-down menu, select Formula.
- Under Text/Symbolic entry, select Student can choose.
- Then, click Save to save the question, or Preview to view it, as shown in Figure 5.33 below.