Difference between revisions of "FormulaDomain1"
Paultpearson (talk | contribs) |
Paultpearson (talk | contribs) (Add link to PGML version in OPL) |
||
Line 6: | Line 6: | ||
</p> |
</p> |
||
* 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 OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/Misc/FormulaDomain1.pg FortLewis/Authoring/Templates/Misc/FormulaDomain1.pg] |
||
+ | * 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" /> |
Revision as of 20:19, 7 June 2015
Answer is a Function with Domain Issues
This PG code shows how to set the domain and test points for a formula.
- File location in OPL: FortLewis/Authoring/Templates/Misc/FormulaDomain1.pg
- PGML location in OPL: FortLewis/Authoring/Templates/Misc/FormulaDomain1_PGML.pg
PG problem file | Explanation |
---|---|
Problem tagging: |
|
DOCUMENT(); loadMacros( "PGstandard.pl", "MathObjects.pl", "AnswerFormatHelp.pl", "answerHints.pl", ); TEXT(beginproblem()); |
Initialization:
We load |
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. |
Context()->texStrings; BEGIN_TEXT (a) Suppose the first answer is \( \displaystyle $answer1 \). $BR \{ ans_rule(20) \} \{ AnswerFormatHelp("formulas") \} $BR $BR (b) Suppose the second answer is \( \displaystyle $answer2 \) $BR \{ ans_rule(20) \} \{ AnswerFormatHelp("formulas") \} END_TEXT Context()->normalStrings; |
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. |
$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", )) ); |
Answer Evaluation:
It is possible to get diagnostic information about the answer checker using
For the second answer, we have used |
Context()->texStrings; BEGIN_SOLUTION ${PAR}SOLUTION:${PAR} Solution explanation goes here. END_SOLUTION Context()->normalStrings; COMMENT('MathObject version.'); ENDDOCUMENT(); |
Solution: |