Simplify fractions for use in feedback


  • Maple TA Interns 2016

    Sometimes in the feedback you have a fraction, but due to the randomised numbers you have it might end up not being in it's simplest form. For example consider you random numbers $a & $b and want to have $a/$b in LaTeX

    \( \frac{$a}{$b} \)
    . To ensure that it is in it's simplest form I use this MapleTA code:


    MapleTA:

    $a = rint(1, 20);

    $b = rint(1, 20);

    $gcd = gcd($a, $b);

    $numerator = $a/$gcd;

    $denominator = $b/$gcd;


    LaTeX:

    \( \frac{$numerator}{\denominator} \)


Log in to reply