DraggableProofs: Difference between revisions
Jump to navigation
Jump to search
(Updated instructions on where the find the draggableProofs.pl macro file.) |
No edit summary |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{historical}} | |||
<p style="font-size: 120%;font-weight:bold">This problem has been replaced with [https://openwebwork.github.io/pg-docs/sample-problems/Misc/DraggableProof.html a newer version of this problem]</p> | |||
<h2>Using Draggable Statements</h2> | <h2>Using Draggable Statements</h2> | ||
Line 7: | Line 10: | ||
<p style="background-color:#f9f9f9;border:black solid 1px;padding:3px;"> | <p style="background-color:#f9f9f9;border:black solid 1px;padding:3px;"> | ||
This PG code shows how | This PG code shows how develop a proof with random statements that need to go in the correct order. | ||
</p> | </p> | ||
* PGML location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/Misc/DraggableProof_PGML.pg FortLewis/Authoring/Templates/Misc/DraggableProof_PGML.pg] | |||
<p style="text-align:center;"> | <p style="text-align:center;"> | ||
Line 17: | Line 22: | ||
<tr valign="top"> | <tr valign="top"> | ||
<th> PG problem file </th> | <th width="50%"> PG problem file </th> | ||
<th> Explanation </th> | <th> Explanation </th> | ||
</tr> | </tr> | ||
Line 29: | Line 34: | ||
DOCUMENT(); | DOCUMENT(); | ||
loadMacros( | loadMacros( | ||
'PGstandard.pl', | |||
'MathObjects.pl', | |||
'PGML.pl', | |||
'draggableProof.pl', | |||
'PGcourse.pl' | |||
); | ); | ||
TEXT(beginproblem()); | |||
</pre> | </pre> | ||
Line 39: | Line 47: | ||
<td style="background-color:#ccffcc;padding:7px;"> | <td style="background-color:#ccffcc;padding:7px;"> | ||
<p> | <p>Details of the draggableProof.pl macro can be found in [[https://webwork.maa.org/pod/pg/macros/draggableProof.html the POD]]. | ||
</p> | </p> | ||
</td> | </td> | ||
</tr> | </tr> | ||
<!-- | <!-- Setup section --> | ||
<tr valign="top"> | <tr valign="top"> | ||
<td style="background-color:#ffffdd;border:black 1px dashed;"> | <td style="background-color:#ffffdd;border:black 1px dashed;"> | ||
<pre> | <pre> | ||
$statements = [ | |||
'Assume \(\sqrt{2}=\frac{a}{b}\) where \(a,b\) are integers, with \(\text{gcd}(a,b)=1\) ', | |||
'\(2 = \frac{a^2}{b^2}\)', | |||
'\(a^2 = 2b^2\)', | |||
'if \(a^2\) is even, then \(a\) must be even', | |||
'Let \(a=2k\) for \(k\) some integer', | |||
'We can then write \( 2 = \frac{4k^2}{b^2}\) or \(b^2 = 2k^2\)', | |||
'Therefore \(b^2\) is even, so \(b\) is also even', | |||
'If \(a\) and \(b\) are both even, then the initial assumption that \(\text{gcd}(a,b)=1\) is contradicted.', | |||
'\(\sqrt{2}\) is therefore not rational.' | |||
]; | |||
$ | # These are extra statements that are not needed. | ||
$extra = [ | |||
'Then \(a\) is odd', | |||
'\(b^2\) cannot be rational.', | |||
] | 'therefore \(a = 2b\)' | ||
]; | |||
$proof = DraggableProof( | |||
$statements, | |||
$extra | |||
); | |||
); | |||
</pre> | </pre> | ||
</td> | </td> | ||
<td style="background-color:# | <td style="background-color:#ffffcc;padding:7px;"> | ||
<p> | <p> | ||
options | The <code>DraggableProof</code> function takes an arrayref of correct statements, followed (optionally) by extra statements. See the POD for more options. | ||
</p> | </p> | ||
</td> | </td> | ||
Line 84: | Line 92: | ||
<!-- | <!-- Print Problem Statement --> | ||
<tr valign="top"> | <tr valign="top"> | ||
<td style="background-color:# | <td style="background-color:#ffdddd;border:black 1px dashed;"> | ||
<pre> | <pre> | ||
BEGIN_PGML | |||
[@ $proof->Print @]* | |||
END_PGML | |||
</pre> | |||
</td> | |||
<td style="background-color:#ffcccc;padding:7px;"> | |||
</td> | |||
</tr> | |||
<!-- Answer section --> | |||
<tr valign="top"> | |||
<td style="background-color:#eeddff;border:black 1px dashed;"> | |||
<pre> | |||
ANS($proof->cmp); | |||
</pre> | |||
<td style="background-color:#eeccff;padding:7px;"> | |||
<p> | |||
<b>Answer Evaluation:</b> | |||
</p> | |||
</td> | |||
</tr> | |||
<!-- Solution section --> | |||
<tr valign="top"> | |||
<td style="background-color:#ddddff;border:black 1px dashed;"> | |||
<pre> | |||
BEGIN_PGML_SOLUTION | |||
Solution explanation goes here. | |||
END_PGML_SOLUTION | |||
COMMENT('Allows integration in either order. Uses PGML.'); | |||
ENDDOCUMENT(); | ENDDOCUMENT(); | ||
</pre> | </pre> | ||
<td style="background-color:#ddddff;padding:7px;"> | <td style="background-color:#ddddff;padding:7px;"> | ||
<p> | |||
<b>Solution:</b> | |||
</p> | |||
</td> | </td> | ||
</tr> | </tr> | ||
</table> | </table> | ||
Line 120: | Line 149: | ||
</p> | </p> | ||
[[Category:Sample Problems]] | [[Category:Sample Problems]] | ||
[[Category:Subject Area Templates]] | [[Category:Subject Area Templates]] | ||
Line 132: | Line 160: | ||
[[Category:Problem Techniques]] | [[Category:Problem Techniques]] | ||
<ul> | <ul> | ||
<li>POD documentation: [ | <li>POD documentation: [https://webwork.maa.org/pod/pg/macros/draggableProof.html draggableProof.html]</li> | ||
</ul> | </ul> | ||
Latest revision as of 13:08, 28 June 2023
This problem has been replaced with a newer version of this problem
Using Draggable Statements
This PG code shows how develop a proof with random statements that need to go in the correct order.
- PGML location in OPL: FortLewis/Authoring/Templates/Misc/DraggableProof_PGML.pg
PG problem file | Explanation |
---|---|
DOCUMENT(); loadMacros( 'PGstandard.pl', 'MathObjects.pl', 'PGML.pl', 'draggableProof.pl', 'PGcourse.pl' ); TEXT(beginproblem()); |
Details of the draggableProof.pl macro can be found in [the POD]. |
$statements = [ 'Assume \(\sqrt{2}=\frac{a}{b}\) where \(a,b\) are integers, with \(\text{gcd}(a,b)=1\) ', '\(2 = \frac{a^2}{b^2}\)', '\(a^2 = 2b^2\)', 'if \(a^2\) is even, then \(a\) must be even', 'Let \(a=2k\) for \(k\) some integer', 'We can then write \( 2 = \frac{4k^2}{b^2}\) or \(b^2 = 2k^2\)', 'Therefore \(b^2\) is even, so \(b\) is also even', 'If \(a\) and \(b\) are both even, then the initial assumption that \(\text{gcd}(a,b)=1\) is contradicted.', '\(\sqrt{2}\) is therefore not rational.' ]; # These are extra statements that are not needed. $extra = [ 'Then \(a\) is odd', '\(b^2\) cannot be rational.', 'therefore \(a = 2b\)' ]; $proof = DraggableProof( $statements, $extra ); |
The |
BEGIN_PGML [@ $proof->Print @]* END_PGML |
|
ANS($proof->cmp); |
Answer Evaluation: |
BEGIN_PGML_SOLUTION Solution explanation goes here. END_PGML_SOLUTION COMMENT('Allows integration in either order. Uses PGML.'); ENDDOCUMENT(); |
Solution: |
- POD documentation: draggableProof.html