## WeBWorK Problems

by Peter Staab -
Number of replies: 2
I've been playing with compoundProblem5 and MultiAnswer within it.  I'm getting a strange result where I enter the correct expression  in the first ans_rule and I get the following in the entered column : "-\left(\sin\!\left(4x\right)\right)\tan\!\left(4x\right)/4x"

and the warning: Unexpected character '\'

It appears that the tex version is being sent as the input.

Here is the relevant code (the entire problem is about 300 lines, so I'll save you some headaches):

$top3= Compute("-sin($b*x)*tan($b*x)");$bottom3 = Compute("$b*x");$dtop3 = $top3->D;$dbottom3 = $bottom3->D;$limit5 = MultiAnswer($top3,$bottom3)->with(
singleResult => 0,
checker => sub {
my ( $correct,$student, $self ) = @_; my ($studNum,$studDen) =@{$student};
my $studentAns = Compute("$studNum/$studDen"); my ($correctNum,$correntDen) = @{$correct};
my $correctAns = Compute("$correctNum/$correntDen"); my$denomLinear =  $studDen->D()->D() == Compute(0);$self->setMessage(2,"The denominator must be linear") unless $denomLinear; my$result = $studentAns ==$correctAns && $denomLinear; return$result;
});

if ($displayMode eq 'TeX') {$showLimit =
"$limit ".limit5->ans_rule(10).limit5->ans_rule(10)."$";
} else {
$showLimit = ColumnTable( "$$\displaystyle limit$$",$limit5->ans_rule(20).$BR.$HR.limit5->ans_rule(20), indent => 0, separation => 10, valign => "MIDDLE" ); } Context()->texStrings; DISPLAY_SECTION( { name=>"5: Rewrite and apply L'Hopital's Rule Again", canshow =>scaffold->requireCorrect(7,8,9). " or $isInstructor", iscorrect=>$scaffold->requireCorrect(10,11,12,13),
section=>5
},   <<'END_SECTION');

You found the limit in the previous section to be

$limit \frac{top2}{bottom2}$

Rewrite this into the form where the bottom is a linear function and the top has trigonometric functions.  (Note: do not apply L'Hopital's Rule)

\$showLimit