[system] / trunk / pg / macros / contextIntegerFunctions.pl Repository:
ViewVC logotype

Diff of /trunk/pg/macros/contextIntegerFunctions.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 5550 Revision 5551
1=head1 NAME
2
3contextIntegerFunctions.pl - adds integer related functions C(n,r) and P(n,r).
4
5=head1 DESCRIPTION
6
7This is a Parser context that adds integer related functions C(n,r)
8and P(n,r). They can be used by the problem author and also by
9students if the answer checking is done by Parser. The latter is
10the main purpose of this file.
11
12B<Note:> by default, webwork problems do not permit students to use
13C(n,r) and P(n,r) functions. Problems which do permit this
14should 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
24B<Note:> If the context is set to something else, such as Numeric, it
25can be set back with Context("IntegerFunctions").
26
27=cut
28
1loadMacros('MathObjects.pl'); 29loadMacros('MathObjects.pl');
2 30
3sub _contextIntegerFunctions_init {context::IntegerFunctions2::Init()}; # don't reload this file 31sub _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
28package context::IntegerFunction2; 33package context::IntegerFunction2;
29our @ISA = qw(Parser::Function::numeric2); # checks for 2 numeric inputs 34our @ISA = qw(Parser::Function::numeric2); # checks for 2 numeric inputs
30 35
31sub C { 36sub C {

Legend:
Removed from v.5550  
changed lines
  Added in v.5551

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9