WeBWorK Problems

MathObjects: reduce and reduceConstants

Re: MathObjects: reduce and reduceConstants

by Davide Cervone -
Number of replies: 0
Have you tried using the Fraction context? It is in the pg/macros/contextFraction.pl file.
    loadMacro("contextFraction.pl");
    Context("Fraction");

    $F = Formula("(1/3)x^1-(-x)+0")->reduce;
yields $F equal to "(1/3)*x+x". I think that should do what you want.

Read the comments in the file for additional details.

Davide