Difference between revisions of "EquationsDefiningFunctions"
Jump to navigation
Jump to search
(New page: <h2>Equations Defining Functions (Not Implicit)</h2> <!-- Header for these sections -- no modification needed --> <p style="background-color:#eeeeee;border:black solid 1px;padding:3px...) |
|||
Line 29: | Line 29: | ||
"parserAssignment.pl", |
"parserAssignment.pl", |
||
); |
); |
||
+ | TEXT(beginproblem()); |
||
</pre> |
</pre> |
||
</td> |
</td> |
||
Line 86: | Line 87: | ||
ANS( $eqn->cmp() ); |
ANS( $eqn->cmp() ); |
||
ANS( $f->cmp() ); |
ANS( $f->cmp() ); |
||
+ | |||
+ | ENDDOCUMENT(); |
||
</pre> |
</pre> |
||
<td style="background-color:#eeccff;padding:7px;"> |
<td style="background-color:#eeccff;padding:7px;"> |
Revision as of 01:35, 2 March 2010
Equations Defining Functions (Not Implicit)
This PG code shows how to check student answers that are equations that define functions.
PG problem file | Explanation |
---|---|
DOCUMENT(); loadMacros( "PGstandard.pl", "MathObjects.pl", "parserAssignment.pl", ); TEXT(beginproblem()); |
Initialization:
We need to include the macro file |
Context("Numeric")->variables->are(x=>"Real",y=>"Real"); parser::Assignment->Allow; parser::Assignment->Function("f"); $eqn = Formula("y=5x+2"); $f = Formula("f(x)=5x+2"); |
Setup: We must allow assignment, and declare any function names we wish to use. |
BEGIN_TEXT Enter \( y = 5x+2 \) \{ ans_rule(20) \} $BR Enter \( f(x) = 5x+2 \) \{ ans_rule(20) \} END_TEXT |
Main Text: The problem text section of the file is as we'd expect. |
ANS( $eqn->cmp() ); ANS( $f->cmp() ); ENDDOCUMENT(); |
Answer Evaluation: As is the answer. |
- POD documentation: parserAssignment.pl.html
- PG macro parserAssignment.pl