Indefinite integrals
Download file: IndefiniteIntegrals.pg
DOCUMENT();
loadMacros(
'PGstandard.pl', 'PGML.pl',
'parserFormulaUpToConstant.pl', 'PGcourse.pl'
);
Preamble
The macro parserFormulaUpToConstant.pl will allow the entry of formula with a general constant like the antiderivative.
# Specific antiderivative: Marks correct e^x, e^x + pi, etc
$specific = Formula('e^x');
# General antiderivative: Marks correct e^x + C, e^x + C - 3, e^x + K, etc.
$general = FormulaUpToConstant('e^x');
Setup
The specific antiderivative is an ordinary formula. When the
cmp method is called for this answer the
upToConstant option will be passed to specify that it be a
formula evaluated up to a constant.
For the general antiderivative the FormulaUpToConstant
method provided by parserFormulaUpToConstant.pl
is used.
BEGIN_PGML
a. Enter a specific antiderivative for [`e^x`]:
[_]{ $specific->cmp(upToConstant => 1) }{10}
b. Enter the most general antiderivative for [`e^x`]:
[_]{$general}{10}
END_PGML
Statement
The option upToConstant => 1 is passed to the
cmp method for the first answer rule to specify that the
any answer that differs from the given answer only by a constant is to
be accepted.
The second answer $general is created with
FormulaUpToConstant which means that an arbitrary additive
constant must be included in the answer. Any letter aside that is not a
variable in the context or e
can be used to represent the arbitrary constant.
BEGIN_PGML_SOLUTION Solution explanation goes here. END_PGML_SOLUTION ENDDOCUMENT();
Solution
A solution should be provided here.