

1  =head1 NAME 


2  


3  contextLimitedPolynomial.pl  Allow only entry of polynomials. 


4  


5  =head1 DESCRIPTION 


6  


7  Implements a context in which students can only enter (expanded) 


8  polynomials (i.e., sums of multiples of powers of x). 


9  


10  Select the context using: 


11  


12  Context("LimitedPolynomial"); 


13  


14  If you set the "singlePowers" flag, then only one monomial of each 


15  degree can be included in the polynomial: 


16  


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


18  


19  There is also a strict limited context that does not allow 


20  operations even within the coefficients. Select it using: 


21  


22  Context("LimitedPolynomialStrict"); 


23  


24  In addition to disallowing operations within the coefficients, 


25  this context does not reduce constant operations (since they are 


26  not allowed), and sets the singlePowers flag automatically. In 


27  addition, it disables all the functions, though they can be 


28  reenabled, if needed. 


29  


30  =cut 
1  
31  
2  loadMacros("MathObjects.pl"); 
32  loadMacros("MathObjects.pl"); 
3  
33  
4  sub _contextLimitedPolynomial_init {LimitedPolynomial::Init()}; # don't load it again 
34  sub _contextLimitedPolynomial_init {LimitedPolynomial::Init()}; # don't load it again 
5  


6  =head3 Context("LimitedPolynomial") 


7  


8  ########################################################## 


9  # 


10  # Implements a context in which students can only enter (expanded) 


11  # polynomials (i.e., sums of multiples of powers of x). 


12  # 


13  # Select the context using: 


14  # 


15  # Context("LimitedPolynomial"); 


16  # 


17  # If you set the "singlePowers" flag, then only one monomial of each 


18  # degree can be included in the polynomial: 


19  # 


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


21  # 


22  # There is also a strict limited context that does not allow 


23  # operations even within the coefficients. Select it using: 


24  # 


25  # Context("LimitedPolynomialStrict"); 


26  # 


27  # In addition to disallowing operations within the coefficients, 


28  # this context does not reduce constant operations (since they are 


29  # not allowed), and sets the singlePowers flag automatically. In 


30  # addition, it disables all the functions, though they can be 


31  # reenabled, if needed. 


32  # 


33  


34  =cut 


35  
35  
36  ################################################## 
36  ################################################## 
37  # 
37  # 
38  # Handle common checking for BOPs 
38  # Handle common checking for BOPs 
39  # 
39  # 