Maple Grading Issues: Intervals

 

Questions that require intervals as answers require special care in Maple grading.

Simple Case

Open intervals are the easiest to mark. If the answer is (a,b) simply use the grading code:

evalb(($RESPONSE)=((a,b)));

a and b can be algorithmic and even infinities! To mark for an infinite endpoint use the word infinity in the grading code.

Closed Endpoints

This is not as simple, as Mobius will not accept evalb(($RESPONSE)=((a,b]));. In addition fully closed intervals must be dealt with differently than half-closed ones.

Half-closed Intervals

Use the RealRange function to define a half-closed interval:

evalb(($RESPONSE)=(RealRange(Open(-2),1)));

will mark (-2,1] as correct. Notice that the default endpoint in RealRange is closed. For the open endpoint use the Open(..) function. The exception of course is an infinite endpoint: RealRange(2,infinity) is [2, ∞)

Fully closed Intervals

Unfortunately RealRange(1,2) is NOT taken as the interval [1,2] in Mobius (it is in Maple). I suspect it has something to do with it being taken as a List. However that is the way to deal with this case. For and answer of [a,b] use the following:

A:=convert($RESPONSE,list);
evalb(A=[a,b])

Displaying Answers

You can either use a simple printf statement:

printf("%A", " (-∞,1)")

or you can use the MathML expression. You need to enclose intervals in quotes in this case.

 

printf(MathML[ExportPresentation]("(-∞,1)"));

For a fully closed interval quotes are not needed:

printf(MathML[ExportPresentation]([a,b]))

Maple Grading Issues Index

Main Index

Last updated: 2024/07/02 SS/DAG