Fixes
Maple Grading Issues

When we use Maple grading, we are now required to use Maple Syntax/Symbolic Mode. This has brought up some issues. Maple syntax has no intelligence about expressions. For example ex is literally treated as an unknown constant "e" raised to the "x". Formula grading is intelligent enought to recognize that expression is the same as exp(x).

This document contains fixes for issues in Maple grading caused by this.

The Problem(?) with xy

To Maple xy is NOT the same as x*y. You can just grade against xy if the question allows. For example if the answer to the question is 2xy then grading against 2*xy will work. Two problems though:

  1. If the user uses explicit multiplication 2 x*y that grading code will not work. (Note that the multiplication between 2 and x*y is automatically taken care of since Equation Editor inserts a blank there.) In that case grade against both possibilities:
     
    evalb($RESPONSE=2*xy) or evalb($RESPONSE=2*x*y);
     
  2. You may need to allow simplification of a response. In that case the multiplication needs to be explicit. Make a substitution:
     
    R:="$RESPONSE";
    R0:=StringTools:-SubstituteAll(R,"xy","x*y");
    R1:=parse(R0);
    evalb(simplify(R1)=2*x*y);
     

The Problem with Brackets on Brackets

Maple grading will misinterpret expressions like . In this case Maple will take this expression to be a function evaluated at . Explicit multiplication would fix this, but you cannot expect students to do that consistently.

There are two ways to handle this:

  1. Simple fix
    If you know the answer explicitly, that is it is not generated algorithmically, you can simply grade for both cases:

    A:=H(t)*(t-1);
    B:=H(t)(t-1);
    is(simplify($RESPONSE)=simplify(A)) or is(simplify($RESPONSE)=simplify(B));

  2. More general fix
    The easiest way to fix this problem is to do a global substitute of all occurrences of ")(" and/or "variable(". Suppose, for example, student answers could include "x(x-1)". Then convert to explicit multiplication as follows:
     
    R:="$RESPONSE";
    R1:=StringTools:-Substitute(R,"x(","x*(");
    R2:=parse(R1);
     
    You can then compare R1 to your expected answer.
     
    You can deal with all occurrences of ")(" with a global substitution:
     
    R1:=StringTools:-SubstituteAll(R,")(",")*(");
     
    Notice that forms like "#(", for example "2(x-1)" are parsed correctly.

    Please see the section "The Problem with nπ and π(...)" below for dealing with issues with π. It is not treated as a number, nor is it treated consistently as a variable.

The Problem with e(t)

An exponential raised to any single-character in brackets is interpreted as a derivative. For example to Maple e(2) is the second derivative of e. Even worse, e(t) is parsed as the "t-th" derivative and returns this usgly string:
 
diff(e(x),x $ t)
 
The only solution is to substitute for this expression:
 
M:=0;
R:="$RESPONSE";
A:=searchtext("diff",R);

 
if (A>0) then
   B:=searchtext("t)",R)+1;
 
   if (B>0) then
     C:=parse(StringTools:-Substitute(R, R[A .. B], "e^t"));
   end if;
 
   else
     C:=parse(R);
   end if;
 
M:=evalb(1/(t+e^(t))-C=0);
M;
 

The Problem with and π(...)

Consider the following:
If you enterMobius sees:
`nπ`
πn`πn`
π(x - 1)Pi(x-1) (≠ Pi*(x - 1))
(x - 1)π(x-1)*Pi (= Pi*(x - 1))
To deal with the first two cases, you need to make a global substitution:
 
A:=StringTools:-SubstituteAll("$RESPONSE","`","");
 
This leaves the string which can also be substituted out:
 
B:=StringTools:-SubstituteAll(A,"n& pi;","n*Pi"); &/or
 
B1:=StringTools:-SubstituteAll(B,"& pi;n","n*Pi");
 
Note that & pi; must be used instead of π as Maple does not recognize the character π. Note: Do NOT leave a space between & and pi; . It is done here to prevent the browser from rendering & pi; as the pi character.
 
The third case is also a simple substitution:
 
C:=StringTools:-Substitute("$RESPONSE","Pi(x-1)","Pi*(x-1)");
 
Note: In all cases of substituting you must convert the result back to a Maple expression before grading:
 
AMark:=parse(A);

Fixes Index

Main Index

Last updated: 2022/07/05 SS/DAG