An equation defining a function
Download file: EquationDefiningFunction.pg
DOCUMENT();
loadMacros('PGstandard.pl', 'PGML.pl', 'parserAssignment.pl', 'PGcourse.pl');
Preamble
The macro file parserAssignment.pl needs to be included.
Context()->variables->are(x => 'Real', y => 'Real');
parser::Assignment->Allow;
parser::Assignment->Function('f');
$eqn = Formula('y = 5x + 2');
$fun = Formula('f(x) = 3x^2 + 2x');
Setup
To allow assignments in the current context call
parser::Assignment->Allow. To allow students to enter an
assignment in which the left side is a function use
parser::Assignment->Function('f'). For more details, see
parserAssignment.pl.
BEGIN_PGML
Enter [`[$eqn]`]: [_]{$eqn}{10}
Enter [`[$fun]`]: [_]{$fun}{10}
END_PGML
Statement
This is the problem statement in PGML.BEGIN_PGML_SOLUTION Solution explanation goes here. END_PGML_SOLUTION ENDDOCUMENT();
Solution
A solution should be provided here.