FormattingCorrectAnswers: Equations: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
(added historical tag and gave updated problem link) |
||
(4 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
<h2> | {{historical}} | ||
<h2>Formatting Correct Answers: Equations: PG Code Snippet</h2> | |||
<!-- Header for these sections -- no modification needed --> | <!-- Header for these sections -- no modification needed --> | ||
Line 28: | Line 30: | ||
<td style="background-color:#ccffcc;padding:7px;"> | <td style="background-color:#ccffcc;padding:7px;"> | ||
<p> | <p> | ||
We don't have to change the tagging and documentation section of the problem file. | |||
tagging and documentation section of the problem file. | In the initialization section, we need to include the macros file <code>parserImplicitPlane.pl</code>. | ||
In the initialization section, we need to include the macros file <code> | |||
</p> | </p> | ||
</td> | </td> | ||
Line 40: | Line 41: | ||
<td style="background-color:#ffffdd;border:black 1px dashed;"> | <td style="background-color:#ffffdd;border:black 1px dashed;"> | ||
<pre> | <pre> | ||
$ | $dfx = 3; | ||
$yintercept = 4; | |||
Context("ImplicitPlane"); | |||
Context()->variables->remove("z"); | |||
$h = ImplicitPlane("y = $dfx x + $yintercept"); | |||
</pre> | </pre> | ||
</td> | </td> |
Latest revision as of 13:45, 28 June 2023
Formatting Correct Answers: Equations: PG Code Snippet
This code snippet shows the essential PG code to check student answers that are equations. Note that these are insertions, not a complete PG file. This code will have to be incorporated into the problem file on which you are working.
PG problem file | Explanation |
---|---|
loadMacros("parserImplicitPlane.pl"); |
We don't have to change the tagging and documentation section of the problem file.
In the initialization section, we need to include the macros file |
$dfx = 3; $yintercept = 4; Context("ImplicitPlane"); Context()->variables->remove("z"); $h = ImplicitPlane("y = $dfx x + $yintercept"); |
In the problem set-up section of the file, we specify that the Context should be Notes: on using this and related Contexts. |
BEGIN_TEXT ...... question text ...... END_TEXT |
The problem text section of the file is as we'd expect. |
ANS( $expr->cmp() ); |
As is the answer. |