An equation defining a function
Download file: EquationDefiningFunction.pg
DOCUMENT(); loadMacros('PGstandard.pl', 'PGML.pl', 'parserAssignment.pl', 'PGcourse.pl');
Preamble
We need to include the macro file parserAssignment.pl
.
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
We must allow assignment, and declare any function names we wish to use. For more details and examples in other MathObjects contexts, 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.