Robust expression grading


  • administrators

    The following is a robust way of grading expressions using Maple:

    abs(convert(convert(simplify(expand(input/ta)), rational), expln)-1) < 1e-8;
    

    We expand to deal with equivalent exponential expressions occasionally not being recognised, then simplify to deal with many other issues. Next we convert to rational before converting to exponential or logarithmic form. The rational conversion is key as there is a bug in Maple causing

    convert(1/(x^3.0+x^5.0), expln); 

    and some related expressions to not evaluate (tested in Maple 2015 & Maple 18). We then subtract one and take the absolute value, so the student cannot input the negative of the teachers answer and be marked correct. Finally we ensure that the result is below \( 10^{-8} \), as Maple TA converts \( \pi \) and other constants to a float.

    You can go a lot deeper into expression grading, but the above is a good base to start from.


  • administrators

    I often use this grading code

    evalb(convert(simplify(expand(simplify(input-ta, symbolic)), symbolic), expln) = 0)
    

Log in to reply