WeBWorK Problems

Interval notation for the students

Interval notation for the students

by Valerio De Angelis -
Number of replies: 0
I would like the students to be able to always use the same notation for infinity in their answers, that is, I=infinity, -I=-Infinity. I know how to do this when the answer is just I or -I, but I am not able to get the answer evaluator to accept 
an interval in the form (-I,4] for example. In the problem below, the answer has to be entered as (-Infinity,2) or (-inf,2), but I would like the students to be able to enter (-I,2). Is this possible?
Thanks in advance.



DOCUMENT();       

loadMacros("PGstandard.pl",
"MathObjects.pl",
"PGgraphmacros.pl",
"PGML.pl",
"AnswerFormatHelp.pl",
"PGcourse.pl"
);




TEXT(beginproblem());


$showPartialCorrectAnswers = 1;
$refreshCachedImages=1;

Context("Point");

$pixels=400;

#create the canvas
$gr=init_graph(-10,-10,10,10,# xmin,ymin, xmax, ymax
axes=>[0,0],grid=>[20,20],size=>[$pixels,$pixels]);
$gr->lb('reset'); #remove default labels

# axes labels
$gr->lb(new Label(9.5,0,'x','black','center','bottom'));
$gr->lb(new Label(0.1,9.5,'y','black','left','middle'));

foreach my $i (-10..10){
$gr->lb( new Label($i,0,$i,'black','center','top'));
$gr->lb( new Label(-0.1,$i,$i,'black','right','middle'));
}
#plot a function
$e=0.1;
$t1=random(2,2,1);
$t11=$t1-$e;
$t12=$t1+$e;
$t2=$t1+2;
$t20=$t2-$e;
$t21=$t2+2*$e;
$t3=$t2+4;
$t30=$t3-$e;
$t31=$t3+$e/4;
$t22=$t2+2;


$L1=Formula("-1/(x-$t1)+2");
$L2=Formula("7/2");
$L3=Formula("3*sin(3*(x-$t3))+7/2");
$a=3*sin(3*(9-$t3))+7/2;

add_functions($gr, "$L1 for x in <-10,$t11> using color:blue and weight:2",
"$L1 for x in <$t12,$t20> using color:blue and weight:2",
"$L2 for x in <$t21,$t30> using color:blue and weight:2",
"$L3 for x in <$t31,9> using color:blue and weight:2");

$gr->stamps(
      new Circle($t2,2.5,4,'blue','blue'));
$gr->stamps(
      new Circle($t2,1.5,4,'blue',''));
$gr->stamps(
      new Circle($t2,3.5,4,'blue',''));
$gr->stamps(
      new Circle($t3,1,4,'blue','blue'));

$gr->stamps(
      new Circle($t3,3.5,4,'blue',''));

$gr->stamps(
      new Circle(9,$a,4,'blue','blue'));


$ans=Interval("(-inf,$t1)");


BEGIN_PGML
The graph of [` f(x)`] is shown in the picture. 

>>[@image(insertGraph($gr),width=>$pixels, height=>$pixels, tex_size=>900) @]*<<
The function is continuous on [_____]{$ans}
END_PGML

BEGIN_PGML_SOLUTION
*SOLUTION*
END_PGML_SOLUTION

ENDDOCUMENT();