# 'Wildcard' in Grading Code browsing

• In order to simplify the algorithm for partial grading of a maple graded question I would like to have part of the response of the student be 'ignored'. For instance: the following formula is the correct answer:

. This response will give the student a full score .  In this formula the part should be correct to gain a partial score, regardless mistakes in the second part,

Can I create a grading code that allows for that?

I was thinking of: multiplying the student response with

and evaluating whether any of these parameters E, k or rho are still present in the adjusted student response.

Is this possible? If yes, what's the code?

Hope anyone can help me with this

• Hi @Metahofzicht. Here is a way to do this in Maple. I have attached a working version for Maple T.A..

fact:=k*rho/E;
TA:=fact*sqrt(2*L^2/S);
if TA = RESPONSE then  1.0;
elif algsubs(fact = 1,RESPONSE) <> RESPONSE then  0.5;
else  0;
end if

• @jmtrik Thanks Jonathan. Never could have found this myself

• @Metahofzicht This code should work but depending on your use case you may need to tweak it a bit. Often the easiest way to think about grading code is through the unit tests. For example, here are the unit tests that I used to test this grading code. What ever code I write must give the correct grade for the all the unit tests.

#### Unit Tests

k*rho/E*sqrt(2*L^2/S)    k*rho/E*sqrt(2*L^2/S)         1.0
k*rho/E*sqrt(2*L^2/S)    k*rho/E*sqrt(L^2/S)             0.5
k*rho/E*sqrt(2*L^2/S)    0                                          0

If you add some other cases to this list, we can further refine the grading code.

• @jmtrik I have some alternative responses to the same question, that are not resembling the other options:

H[m]*A*L*rho                      H[m]*A*L*rho                      1.0
H[m]*sqrt(3)/4*a^2*L*rho    H[m]*sqrt(3)/4*a^2*L*rho    1.0
H[m]*sqrt(3)/4*a^2*L*rho    H[m]*a^2*L*rho                   0.5  (the numerical factor is not relevant for the final answer to the problem)

• @Metahofzicht Is this for a different question? Is this another example of partial expression grading?

• @Metahofzicht I've added a few cases.

• 1.0 for H[m]*sqrt(3)/4*a^2*L*rho or where sqrt(3)/4*a^2 has been replaced by A
• 0.5 if you answer H[m]*a^2*L*rho 0.5 if you answer H[m]*C*a^2*L*rho, where C is any constant (you could set this to give the grade 0.25)
• 0 otherwise

I used this algorithm, where I've defined the grading code. Note I have different cases for C=1 and C= any other constant.

$TA = "H[m]*sqrt(3)/4*a^2*L*rho";$TApartial1="H[m]*a^2*L*rho";
$subslist = "A=sqrt(3)/4*a^2"; #define grading code function$gc=maple("
proc(TA,TApartial1,subslist,RESPONSE)
if evalb(simplify(algsubs(subslist,RESPONSE) = TA)) then  1.0;
elif evalb(simplify(algsubs(subslist,RESPONSE) = TApartial1)) then 0.5;
elif evalb(simplify(RESPONSE = 0)) then 0.0;
elif type(simplify(algsubs(subslist,RESPONSE)/TApartial1),constant) then 0.25;
else  0;
end if
;end proc;
");

And the I have used a Maple-graded question with Maple-syntax and the following grading code.

$gc($TA,$TApartial1,$subslist,$RESPONSE) Here is the Maple T.A. question Partgradfactorexample2.zip • @jmtrik Hi , Jonathan. I'm trying my best to apply the procedure on other examples. But I get stuck in the following example: (introducing the parameter I - second moment of area - that needs special treatment due to the confusion with imaginairy numbers and a second substition): Teacher's Answer Student's Answer Expected Grade C[1]*E*I/L^3 C[1]*E*I/L^3 1.0 C[1] equals C C[1]*E*I/L^3 C[1]*E*a^4/(32*sqrt(3)*L^3) 1.0 C[1] equals C C[1]*E*I/L^3 6*E*a^4/(sqrt(3)*L^3) 1.0 C[1] = 192 C[1]*E*I/L^3 Constant*E*a^4/L^3 0.8 Constant is any number C[1]*E*I/L^3 Factor*E*a^4/L^3 0.5 Factor is any parameter$fact = "E*a^4/L^3";
$TA = "$fact*6/sqrt(3)";
$subslist1 = Maple("local I:='I ': I=a^4/32/sqrt(3)");$subslist2 = "C[1] = C = 192";
$TApartial1 = "E*a^4/L^3"; #define test cases$RESPONSE1="$TA";$RESPONSE2="$TApartial1";$RESPONSE3="0";

• @Metahofzicht Nailed it. I found out how to fix it.

if evalb(simplify(algsubs(I = a^4/(32*sqrt(3)), algsubs(C = 192, $RESPONSE) =$RV1))) then 1.0;
elif evalb(simplify(algsubs(I = a^4/(32*sqrt(3)), algsubs(C[1] = 192, $RESPONSE) =$RV1))) then 1.0;
elif algsubs($fact2 = 1,$RESPONSE) <> $RESPONSE then 1.0; else 0.0; end if; Custom previewing code: local I:=I :printf(MathML[ExportPresentation]($RESPONSE));
$fact2 = "E*a^4/L^3";$RV1 = "$fact2*2*sqrt(3)";$RVdisplay = "printf(MathML[ExportPresentation](\$RV1))";