Maple-graded code for list [1,2]
-
Problem:
evalb( $ANSWER = $RESPONSE)
with $ANSWER set as [-1, 0.5] , grading code will return 0 when student answers it as [-1, 1/2].
The reason for this is "evalb()". It performs a single, cursory comparison, therefore:
evalb( 0.5 = 1/2 ); # returns 1 or true, because it's one step operation evalb( [0.5] = [1/2] ); # returns 0 of false, because it's a two step operation evalb( [0.5] = [0.5] ); # returns 1 or true, because it's one step operation
Solutions:
evalb( simplify( $ANSWER - $RESPONSE = [0.,0.] ) ); # 'quick and dirty'
or
andmap(evalb, `~`[`=`]($ANSWER, $RESPONSE)); # Maple "export" notation
or
andmap(evalb, $ANSWER=~$RESPONSE ); # alternative notation