FormulaAnswer1: Difference between revisions
Jump to navigation
Jump to search
Paultpearson (talk | contribs) (Add link to PGML version in OPL) |
(add historical tag and give links to newer problems.) |
||
(2 intermediate revisions by the same user 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/FormulaAnswer.html a newer version of this problem]</p> | |||
<h2>Answer is a Number or a Formula - [https://testcourses.webwork.maa.org/webwork2/Problem_Authoring_Techniques/T-PP-misc/1 Try it out]</h2> | <h2>Answer is a Number or a Formula - [https://testcourses.webwork.maa.org/webwork2/Problem_Authoring_Techniques/T-PP-misc/1 Try it out]</h2> | ||
Line 5: | Line 10: | ||
This PG code shows how to write a question whose answer is a number or a formula. | This PG code shows how to write a question whose answer is a number or a formula. | ||
</p> | </p> | ||
* File location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/Misc/FormulaAnswer1.pg FortLewis/Authoring/Templates/Misc/FormulaAnswer1.pg] | <!--* File location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/Misc/FormulaAnswer1.pg FortLewis/Authoring/Templates/Misc/FormulaAnswer1.pg]--> | ||
* PGML location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/Misc/FormulaAnswer1_PGML.pg FortLewis/Authoring/Templates/Misc/FormulaAnswer1_PGML.pg] | * PGML location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/Misc/FormulaAnswer1_PGML.pg FortLewis/Authoring/Templates/Misc/FormulaAnswer1_PGML.pg] | ||
Line 16: | Line 21: | ||
<tr valign="top"> | <tr valign="top"> | ||
<th> PG problem file </th> | <th style="width: 50%"> PG problem file </th> | ||
<th> Explanation </th> | <th> Explanation </th> | ||
</tr> | </tr> | ||
Line 42: | Line 47: | ||
DOCUMENT(); | DOCUMENT(); | ||
loadMacros( | loadMacros('PGstandard.pl','MathObjects.pl','PGML.pl','PGcourse.pl'); | ||
); | |||
TEXT(beginproblem()); | TEXT(beginproblem()); | ||
Line 64: | Line 65: | ||
<td style="background-color:#ffffdd;border:black 1px dashed;"> | <td style="background-color:#ffffdd;border:black 1px dashed;"> | ||
<pre> | <pre> | ||
Context( | Context('Numeric'); | ||
$a = non_zero_random(-9,9,1); | $a = non_zero_random(-9,9,1); | ||
Line 86: | Line 87: | ||
<td style="background-color:#ffdddd;border:black 1px dashed;"> | <td style="background-color:#ffdddd;border:black 1px dashed;"> | ||
<pre> | <pre> | ||
BEGIN_PGML | |||
Enter [`[$answer1]`]: [____]{$answer1} [@ helpLink('number') @]* | |||
Enter | |||
Enter [`[$answer2]`]: [____]{$answer2} [@ helpLink('formula') @]* | |||
END_PGML | |||
Enter | |||
</pre> | </pre> | ||
<td style="background-color:#ffcccc;padding:7px;"> | <td style="background-color:#ffcccc;padding:7px;"> | ||
<p> | <p> | ||
<b>Main Text:</b> | <b>Main Text:</b> | ||
< | * The <tt>helpLink</tt> command show some additional help for entering values. | ||
</p> | </p> | ||
</td> | </td> | ||
Line 128: | Line 107: | ||
<td style="background-color:#ddddff;border:black 1px dashed;"> | <td style="background-color:#ddddff;border:black 1px dashed;"> | ||
<pre> | <pre> | ||
BEGIN_PGML_SOLUTION | |||
Solution explanation goes here. | Solution explanation goes here. | ||
END_PGML_SOLUTION | |||
ENDDOCUMENT(); | ENDDOCUMENT(); | ||
</pre> | </pre> |
Latest revision as of 11:15, 17 July 2023
This problem has been replaced with a newer version of this problem
Answer is a Number or a Formula - Try it out

This PG code shows how to write a question whose answer is a number or a formula.
- PGML location in OPL: FortLewis/Authoring/Templates/Misc/FormulaAnswer1_PGML.pg
PG problem file | Explanation |
---|---|
Problem tagging: |
|
DOCUMENT(); loadMacros('PGstandard.pl','MathObjects.pl','PGML.pl','PGcourse.pl'); TEXT(beginproblem()); |
Initialization: |
Context('Numeric'); $a = non_zero_random(-9,9,1); do { $b = random(2,9,1); } until ( $b != $a ); $answer1 = Compute("$a"); $answer2 = Compute("$a x^($b) + $b")->reduce(); |
Setup:
We use |
BEGIN_PGML Enter [`[$answer1]`]: [____]{$answer1} [@ helpLink('number') @]* Enter [`[$answer2]`]: [____]{$answer2} [@ helpLink('formula') @]* END_PGML |
Main Text:
|
BEGIN_PGML_SOLUTION Solution explanation goes here. END_PGML_SOLUTION ENDDOCUMENT(); |
Solution: |