# contextRationalFunction.pl - Only allow rational functions

### From WeBWorK

# NAME

contextRationalFunction.pl - Only allow rational functions (and their products and powers)

# DESCRIPTION

Implements a context in which students can only enter rational functions, with some control over whether a single division is allowed, or whether products of rational functions are allowed.

Select the context using:

Context("RationalFunction");

The RationalFunction context supports all the flags of the PolynomialFactors context, except for strictDivision, since rational functions allow division of polynomials.

In addition, there is a singleQuotients flag that controls whether products of rational functions are allowed or not. By default, they are allowed, but you can set this flag to 1 in order to force the student answer to be as a single fraction.

Finally, there is also a strict context that does not allow operations even within the coefficients. Select it using:

Context("RationalFunction-Strict");

In addition to disallowing operations within the coefficients, this context does not reduce constant operations (since they are not allowed), and sets the singlePowers, singleFactors, singleQuotients, and stricPowers flags automatically. In addition, it disables all the functions, though they can be re-enabled, if needed.