WeBWorK Problems

fractions

fractions

by Zak Zarychta -
Number of replies: 1
Hi there,

How might one display fractions in a problem rather than the reduced decimal. For example the definition

$yb = Compute("pi*r**2*h + (4/3)pi*r**3");

when displayed as follows

Context()->texStrings;
BEGIN_TEXT
(b) \($yb = \) \{ans_rule(20) \}
$PAR
END_TEXT
Context()->normalStrings;

returns the fraction 4/3 as 1.3333

Zak
In reply to Zak Zarychta

Re: fractions

by Davide Cervone -
Use
    Context()->flags->set(reduceConstants=>0);
before your Compute() call so that constants will not be combined.

Davide