Difference between revisions of "SolutionForEquation1"
Jump to navigation
Jump to search
(Created page with '<h2>Answer is Any Solution For an Equation</h2> 300px|thumb|right|Click to enlarge <p style="background-color:#f9f9f9;border:black solid 1px;pa…') |
(add historical tag and give links to newer problems.) |
||
(6 intermediate revisions by 3 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/SolutionForEquation.html a newer version of this problem]</p> |
||
+ | |||
+ | |||
<h2>Answer is Any Solution For an Equation</h2> |
<h2>Answer is Any Solution For an Equation</h2> |
||
Line 5: | Line 10: | ||
This PG code shows how to check whether the student's answer is a solution to an equation. |
This PG code shows how to check whether the student's answer is a solution to an equation. |
||
</p> |
</p> |
||
− | * Download file: [[File:SolutionForEquation1.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/Algebra/SolutionForEquation1.pg FortLewis/Authoring/Templates/Algebra/SolutionForEquation1.pg] |
||
− | * File location in NPL: <code>FortLewis/Authoring/Templates/Algebra/SolutionForEquation1.pg</code> |
||
+ | * PGML location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/Algebra/SolutionForEquation1_PGML.pg FortLewis/Authoring/Templates/Algebra/SolutionForEquation1_PGML.pg] |
||
<br clear="all" /> |
<br clear="all" /> |
||
Line 55: | Line 60: | ||
<p> |
<p> |
||
<b>Initialization:</b> |
<b>Initialization:</b> |
||
+ | We must load <code>parserSolutionFor.pl</code>. |
||
</p> |
</p> |
||
</td> |
</td> |
||
Line 75: | Line 81: | ||
<p> |
<p> |
||
<b>Setup:</b> |
<b>Setup:</b> |
||
+ | We use <code>SolutionFor(equation, point)</code> to define this MathObject. For more details and options, see the [http://webwork.maa.org/pod/pg/macros/parserSolutionFor.html POD documentation] |
||
</p> |
</p> |
||
</td> |
</td> |
||
Line 96: | Line 103: | ||
<p> |
<p> |
||
<b>Main Text:</b> |
<b>Main Text:</b> |
||
+ | To print the formula in the MathObject, we use <code>->f</code>. |
||
</p> |
</p> |
||
</td> |
</td> |
||
Line 146: | Line 154: | ||
[[Category:Top]] |
[[Category:Top]] |
||
− | [[Category: |
+ | [[Category:Sample Problems]] |
+ | [[Category:Subject Area Templates]] |
Latest revision as of 04:44, 18 July 2023
This problem has been replaced with a newer version of this problem
Answer is Any Solution For an Equation
This PG code shows how to check whether the student's answer is a solution to an equation.
- File location in OPL: FortLewis/Authoring/Templates/Algebra/SolutionForEquation1.pg
- PGML location in OPL: FortLewis/Authoring/Templates/Algebra/SolutionForEquation1_PGML.pg
PG problem file | Explanation |
---|---|
Problem tagging: |
|
DOCUMENT(); loadMacros( "PGstandard.pl", "MathObjects.pl", "parserSolutionFor.pl", "AnswerFormatHelp.pl", ); TEXT(beginproblem()); |
Initialization:
We must load |
Context("Vector"); $r = random(3,6,1); $answer = SolutionFor("x^2+y^2+z^2=$r^2", [$r,0,0] ); |
Setup:
We use |
Context()->texStrings; BEGIN_TEXT A solution to the equation \( $answer->{f} \) is \( (x,y,z) = \) \{ ans_rule(20) \} \{ AnswerFormatHelp("points") \} END_TEXT Context()->normalStrings; |
Main Text:
To print the formula in the MathObject, we use |
$showPartialCorrectAnswers = 1; ANS( $answer->cmp() ); |
Answer Evaluation: |
Context()->texStrings; BEGIN_SOLUTION ${PAR}SOLUTION:${PAR} Solution explanation goes here. END_SOLUTION Context()->normalStrings; COMMENT('MathObject version.'); ENDDOCUMENT(); |
Solution: |