contextLimitedPolynomial

From WeBWorK_wiki
Revision as of 15:19, 14 May 2010 by Aubreyja (talk | contribs) (21 revisions: import all default namespace pages from old wiki)
Jump to navigation Jump to search
contextLimitedPolynomial
Category: MathObject Context
Status Standard
Description Allow only entry of polynomials
File Name contextLimitedPolynomial.pl
File Path /pg/macros/contextLimitedPolynomial.pl
Download
Code Docs http://webwork.maa.org/doc/cvs/pg_HEAD/macros/contextLimitedPolynomial.pl.html
NPL Example
Comments:

Purpose of this Macro

In the LimitedPolynomial context, WeBWorK will require all student answers to be (expanded) polynomials (i.e., sums of multiples of powers of x). This context allows also requiring that there be only one term with each power of x.

Initialization

Enable the LimitedPolynomial context in loadMacros:

loadMacros(
  "contextLimitedPolynomial.pl", #Automatically loads MathObjects.pl
);

Select the context using:

Context("LimitedPolynomial");

If you set the ``singlePowers flag, then only one monomial of each degree can be included in the polynomial:

Context("LimitedPolynomial")->flags->set(singlePowers=>1);

There is also a strict limited context that does not allow operations even within the coefficients. Select it using:

Context("LimitedPolynomial-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 flag automatically. In addition, it disables all the functions, though they can be re-enabled, if needed.

Usage

Bug Reports

See Also