

1  =head1 NAME 


2  


3  contextIntegerFunctions.pl  adds integer related functions C(n,r) and P(n,r). 


4  


5  =head1 DESCRIPTION 


6  


7  This is a Parser context that adds integer related functions C(n,r) 


8  and P(n,r). They can be used by the problem author and also by 


9  students if the answer checking is done by Parser. The latter is 


10  the main purpose of this file. 


11  


12  B<Note:> by default, webwork problems do not permit students to use 


13  C(n,r) and P(n,r) functions. Problems which do permit this 


14  should alert the student in their text. 


15  


16  =head1 USAGE 


17  


18  Context("IntegerFunctions") 


19  


20  $b = random(2, 5); $a = $b+random(0, 5); 


21  $c = C($a, $b); 


22  ANS(Compute("P($a, $b)")>cmp); 


23  


24  B<Note:> If the context is set to something else, such as Numeric, it 


25  can be set back with Context("IntegerFunctions"). 


26  


27  =cut 


28  
1  loadMacros('MathObjects.pl'); 
29  loadMacros('MathObjects.pl'); 
2  
30  
3  sub _contextIntegerFunctions_init {context::IntegerFunctions2::Init()}; # don't reload this file 
31  sub _contextIntegerFunctions_init {context::IntegerFunctions2::Init()}; # don't reload this file 
4  


5  =head3 Context("IntegerFunctions") 


6  


7  ###################################################################### 


8  # 


9  # This is a Parser context that adds integer related functions C(n,r) 


10  # and P(n,r). They can be used by the problem author and also by 


11  # students if the answer checking is done by Parser. The latter is 


12  # the main purpose of this file. 


13  # 


14  # Note: by default, webwork problems do not permit students to use 


15  # C(n,r) and P(n,r) functions. Problems which do permit this 


16  # should alert the student in their text. 


17  # 


18  # Usage examples: 


19  # $b = random(2, 5); $a = $b+random(0, 5); 


20  # $c = C($a, $b); 


21  # ANS(Compute("P($a, $b)")>cmp); 


22  # 


23  # Note: If the context is set to something else, such as Numeric, it 


24  # can be set back with Context("IntegerFunctions"). 


25  


26  =cut 


27  
32  
28  package context::IntegerFunction2; 
33  package context::IntegerFunction2; 
29  our @ISA = qw(Parser::Function::numeric2); # checks for 2 numeric inputs 
34  our @ISA = qw(Parser::Function::numeric2); # checks for 2 numeric inputs 
30  
35  
31  sub C { 
36  sub C { 