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

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

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

Revision 5550 Revision 5551
1=head1 NAME
2
3parserDifferenceQuotient.pl - An answer checker for difference quotients.
4
5=head1 DESCRIPTION
6
7This is a Parser class that implements an answer checker for
8difference quotients as a subclass of the Formula class. The
9standard ->cmp routine will work for this. The difference quotient
10is just a special type of formula with a special variable
11for 'dx'. The checker will give an error message if the
12student's result contains a dx in the denominator, meaning it
13is not fully reduced.
14
15Use DifferenceQuotient(formula) to create a difference equation
16object. If the context has more than one variable, the last one
17alphabetically is used to form the dx. Otherwise, you can specify
18the variable used for dx as the second argument to
19DifferenceQuotient(). You could use a variable like h instead of
20dx if you prefer.
21
22Usage examples:
23
24 $df = DifferenceQuotient("2x+dx");
25 ANS($df->cmp);
26
27 $df = DifferenceQuotient("2x+h","h");
28 ANS($df->cmp);
29
30 Context()->variables->are(t=>'Real',a=>'Real');
31 ANS(DifferenceQuotient("-a/[t(t+dt)]","dt")->cmp);
32
33=cut
1 34
2loadMacros('MathObjects.pl'); 35loadMacros('MathObjects.pl');
3 36
4sub _parserDifferenceQuotient_init {DifferenceQuotient::Init()}; # don't reload this file 37sub _parserDifferenceQuotient_init {DifferenceQuotient::Init()}; # don't reload this file
5
6=head1 DESCRIPTION
7
8 ######################################################################
9 #
10 # This is a Parser class that implements an answer checker for
11 # difference quotients as a subclass of the Formula class. The
12 # standard ->cmp routine will work for this. The difference quotient
13 # is just a special type of formula with a special variable
14 # for 'dx'. The checker will give an error message if the
15 # student's result contains a dx in the denominator, meaning it
16 # is not fully reduced.
17 #
18 # Use DifferenceQuotient(formula) to create a difference equation
19 # object. If the context has more than one variable, the last one
20 # alphabetically is used to form the dx. Otherwise, you can specify
21 # the variable used for dx as the second argument to
22 # DifferenceQuotient(). You could use a variable like h instead of
23 # dx if you prefer.
24 #
25 # Usage examples:
26 #
27 # $df = DifferenceQuotient("2x+dx");
28 # ANS($df->cmp);
29 #
30 # $df = DifferenceQuotient("2x+h","h");
31 # ANS($df->cmp);
32 #
33 # Context()->variables->are(t=>'Real',a=>'Real');
34 # ANS(DifferenceQuotient("-a/[t(t+dt)]","dt")->cmp);
35 #
36
37=cut
38 38
39package DifferenceQuotient; 39package DifferenceQuotient;
40our @ISA = qw(Value::Formula); 40our @ISA = qw(Value::Formula);
41 41
42sub Init { 42sub Init {

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

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9