WeBWorK Problems

Problem with Fractions in Answer

Re: Problem with Fractions in Answer

by Alex Jordan -
Number of replies: 0
This is not about your answer checking issue, but if you would like the correct answer to *display* with things like 1/6 instead of 0.1666... then one option is you can replace:

$F = Formula("1/($a+1)*(sin x)**($a+1)");

with

Context()->flags->set(reduceConstants=>0);
$a1 = $a + 1;
$F = Formula("1/$a1*(sin x)**($a1)");

or just replace that one line with:

$F = Formula("(sin x)**($a+1)/($a+1)");

if you are OK with putting the denominator there.