Difference between revisions of "FormulaDomain1"
Paultpearson (talk | contribs) |
(add historical tag and give links to newer problems.) |
||
(5 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/Algebra/DomainRange.html a newer version of this problem]</p> |
||
+ | |||
+ | |||
<h2>Answer is a Function with Domain Issues</h2> |
<h2>Answer is a Function with Domain Issues</h2> |
||
Line 5: | Line 10: | ||
This PG code shows how to set the domain and test points for a formula. |
This PG code shows how to set the domain and test points for a formula. |
||
</p> |
</p> |
||
− | * Download file: [[File:FormulaDomain1.txt]] (change the file extension from txt to pg when you save it) |
||
+ | <!-- * File location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/Misc/FormulaDomain1.pg FortLewis/Authoring/Templates/Misc/FormulaDomain1.pg] --> |
||
− | * File location in NPL: <code>FortLewis/Authoring/Templates/Misc/FormulaDomain1.pg</code> |
||
+ | * PGML location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/Misc/FormulaDomain1_PGML.pg FortLewis/Authoring/Templates/Misc/FormulaDomain1_PGML.pg] |
||
<br clear="all" /> |
<br clear="all" /> |
||
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'); |
||
− | "PGstandard.pl", |
||
− | "MathObjects.pl", |
||
− | "AnswerFormatHelp.pl", |
||
− | "answerHints.pl", |
||
− | ); |
||
TEXT(beginproblem()); |
TEXT(beginproblem()); |
||
Line 55: | Line 55: | ||
<p> |
<p> |
||
<b>Initialization:</b> |
<b>Initialization:</b> |
||
− | We load <code>AnswerFormatHelp.pl</code> to provide help links to students. We load <code>answerHints.pl</code> to provide customized answer hints in the answer evaluation section. |
||
</p> |
</p> |
||
</td> |
</td> |
||
Line 96: | Line 95: | ||
<td style="background-color:#ffdddd;border:black 1px dashed;"> |
<td style="background-color:#ffdddd;border:black 1px dashed;"> |
||
<pre> |
<pre> |
||
− | Context()->texStrings; |
||
+ | BEGIN_PGML |
||
− | BEGIN_TEXT |
||
+ | a. Enter the answer [`` [$answer1]= ``] [__]{$answer1} |
||
− | (a) Suppose the first answer is |
||
+ | |||
− | \( \displaystyle $answer1 \). |
||
+ | b. Enter the answer [`` [$answer2]= ``] [__]{$answer2} |
||
− | $BR |
||
+ | |||
− | \{ ans_rule(20) \} |
||
+ | [@ helpLink('formulas') @]* |
||
− | \{ AnswerFormatHelp("formulas") \} |
||
+ | END_PGML |
||
− | $BR |
||
− | $BR |
||
− | (b) Suppose the second answer is |
||
− | \( \displaystyle $answer2 \) |
||
− | $BR |
||
− | \{ ans_rule(20) \} |
||
− | \{ AnswerFormatHelp("formulas") \} |
||
− | END_TEXT |
||
− | Context()->normalStrings; |
||
</pre> |
</pre> |
||
<td style="background-color:#ffcccc;padding:7px;"> |
<td style="background-color:#ffcccc;padding:7px;"> |
||
Line 118: | Line 108: | ||
Notice that in this multipart question we have grouped the text for each part together in a block, put each answer blank on a new line immediately below each block of text, and added extra space between each part. This should make the question easy to read both in HTML and PDF format. |
Notice that in this multipart question we have grouped the text for each part together in a block, put each answer blank on a new line immediately below each block of text, and added extra space between each part. This should make the question easy to read both in HTML and PDF format. |
||
</p> |
</p> |
||
− | </td> |
||
− | </tr> |
||
− | <!-- Answer evaluation section --> |
||
+ | <p>It is possible to get diagnostic information about the answer checker if one replaces the <code>{$answer1}</code> with <code>{$answer1->cmp(diagnostics=>1)}</code>. When diagnostics are turned on and a student answer is submitted, you will get a graph of the correct answer and the student answer on the same graph, as well as a table that specifies which test points were used by the answer checker, and how much of a difference there was between the student answer and the correct answer at these checkpoints. To test the reliability of your answer checker, it is good to click the reload button on your browser several times after a student answer has been submitted, since reloading changes the test points used. |
||
− | |||
− | <tr valign="top"> |
||
− | <td style="background-color:#eeddff;border:black 1px dashed;"> |
||
− | <pre> |
||
− | $showPartialCorrectAnswers = 1; |
||
− | |||
− | ANS( $answer1->cmp() ); |
||
− | |||
− | ANS( $answer2->cmp() |
||
− | ->withPostFilter(AnswerHints( |
||
− | [Compute("ln(x/(x-$a))"),Compute("ln(x)-ln(x-$a)")] => |
||
− | "Don't forget to use absolute value", |
||
− | )) |
||
− | ); |
||
− | </pre> |
||
− | <td style="background-color:#eeccff;padding:7px;"> |
||
− | <p> |
||
− | <b>Answer Evaluation:</b> |
||
− | It is possible to get diagnostic information about the answer checker using <code>cmp(diagnostics=>1)</code>. When diagnostics are turned on and a student answer is submitted, you will get a graph of the correct answer and the student answer on the same graph, as well as a table that specifies which test points were used by the answer checker, and how much of a difference there was between the student answer and the correct answer at these checkpoints. To test the reliability of your answer checker, it is good to click the reload button on your browser several times after a student answer has been submitted, since reloading changes the test points used. |
||
− | </p> |
||
− | <p> |
||
− | For the second answer, we have used <code>AnswerHints</code> to give students who enter particular answers customized feedback messages. For more details, please see [http://webwork.maa.org/wiki/AnswerHints answer hints] in the index of problem techniques. |
||
</p> |
</p> |
||
</td> |
</td> |
||
Line 178: | Line 144: | ||
[[Category:Top]] |
[[Category:Top]] |
||
− | [[Category:Authors]] |
||
[[Category:Sample Problems]] |
[[Category:Sample Problems]] |
||
[[Category:Subject Area Templates]] |
[[Category:Subject Area Templates]] |
Latest revision as of 06:16, 17 July 2023
This problem has been replaced with a newer version of this problem
Answer is a Function with Domain Issues
This PG code shows how to set the domain and test points for a formula.
- PGML location in OPL: FortLewis/Authoring/Templates/Misc/FormulaDomain1_PGML.pg
PG problem file | Explanation |
---|---|
Problem tagging: |
|
DOCUMENT(); loadMacros('PGstandard.pl','MathObjects.pl','PGML.pl','PGcourse.pl'); TEXT(beginproblem()); |
Initialization: |
Context("Numeric"); $a = random(2,5,1); $answer1 = Compute("sqrt(x-$a)"); $answer1->{limits} = [$a+1,$a+4]; $answer2 = Compute("ln(abs( x / (x-$a) ))"); $answer2->{test_points} = [[-5],[-4],[1],[$a-1],[7],[8]]; |
Setup:
We restrict the domain of function evaluation using
The domain for It is possible to set the domain once for all of the functions within a particular context. For more details, please see formula test points in the index of problem techniques. |
BEGIN_PGML a. Enter the answer [`` [$answer1]= ``] [__]{$answer1} b. Enter the answer [`` [$answer2]= ``] [__]{$answer2} [@ helpLink('formulas') @]* END_PGML |
Main Text: Notice that in this multipart question we have grouped the text for each part together in a block, put each answer blank on a new line immediately below each block of text, and added extra space between each part. This should make the question easy to read both in HTML and PDF format. It is possible to get diagnostic information about the answer checker if one replaces the |
Context()->texStrings; BEGIN_SOLUTION ${PAR}SOLUTION:${PAR} Solution explanation goes here. END_SOLUTION Context()->normalStrings; COMMENT('MathObject version.'); ENDDOCUMENT(); |
Solution: |