EquationImplicitFunction1: Difference between revisions
Paultpearson (talk | contribs) No edit summary |
(add historical tag and give links to newer problems.) |
||
(5 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/EquationImplicitFunction.html a newer version of this problem]</p> | |||
<h2>Answer is an Equation that Implicitly Defines a Function</h2> | <h2>Answer is an Equation that Implicitly Defines a Function</h2> | ||
Line 5: | Line 10: | ||
This PG code shows how to have an answer that is an equation that implicitly defines a function. | This PG code shows how to have an answer that is an equation that implicitly defines a function. | ||
</p> | </p> | ||
* | <!-- * File location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/Algebra/EquationImplicitFunction1.pg FortLewis/Authoring/Templates/Algebra/EquationImplicitFunction1.pg] --> | ||
* | * PGML location in OPL: [https://github.com/openwebwork/webwork-open-problem-library/blob/master/OpenProblemLibrary/FortLewis/Authoring/Templates/Algebra/EquationImplicitFunction1_PGML.pg FortLewis/Authoring/Templates/Algebra/EquationImplicitFunction1_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', | ||
'parserImplicitEquation.pl','PGML.pl','PGcourse.pl'); | |||
); | |||
TEXT(beginproblem()); | TEXT(beginproblem()); | ||
</pre> | </pre> | ||
Line 65: | Line 65: | ||
<td style="background-color:#ffffdd;border:black 1px dashed;"> | <td style="background-color:#ffffdd;border:black 1px dashed;"> | ||
<pre> | <pre> | ||
Context( | Context('ImplicitEquation'); | ||
Context()->{error}{msg}{ | Context()->{error}{msg}{ | ||
"Can't find any solutions to your equation"} = | "Can't find any solutions to your equation"} = ' '; | ||
Context()->{error}{msg}{ | Context()->{error}{msg}{ | ||
"Can't generate enough valid points for comparison"} = | "Can't generate enough valid points for comparison"} = ' '; | ||
Context()->variables->set( | Context()->variables->set( | ||
Line 79: | Line 79: | ||
$b = random(1,5,1); | $b = random(1,5,1); | ||
$r = random(2,5,1); | $r = random(2,5,1); | ||
$p = Compute("($a,$b)"); | |||
$answer = ImplicitEquation( | $answer = ImplicitEquation( | ||
"(x-$a)^2 + (y-$b)^2 = $r^2", | "(x-$a)^2 + (y-$b)^2 = $r^2", | ||
solutions=>[ | solutions=>[ | ||
[$a,$b+$r], | [$a,$b+$r], | ||
[$a,$b-$r], | [$a,$b-$r], | ||
Line 95: | Line 96: | ||
<p> | <p> | ||
<b>Setup:</b> | <b>Setup:</b> | ||
We quash some error messages by redefining them to be a blank string <code>" "</code> (notice the space). Since the circle will always be contained in a rectangle with two opposite corners at <code>(-4,-4)<code> and <code>(10,10)</code>, we set the limits for the variables x and y to be outside of this rectangle. The <code>ImplicitEquation</code> object allows us to specify as many solutions as we like, and doing so should improve the accuracy of the answer evaluator. | We quash some error messages by redefining them to be a blank string <code>" "</code> (notice the space). Since the circle will always be contained in a rectangle with two opposite corners at <code>(-4,-4)</code> and <code>(10,10)</code>, we set the limits for the variables x and y to be outside of this rectangle. The <code>ImplicitEquation</code> object allows us to specify as many solutions as we like, and doing so should improve the accuracy of the answer evaluator. | ||
</p> | </p> | ||
<p> | <p> | ||
Line 108: | Line 109: | ||
<td style="background-color:#ffdddd;border:black 1px dashed;"> | <td style="background-color:#ffdddd;border:black 1px dashed;"> | ||
<pre> | <pre> | ||
BEGIN_PGML | |||
Enter an equation for a circle in the [`xy`]-plane | |||
Enter an equation for a circle in the xy-plane | of radius [` [$r] `] centered at [` [$p] `]. | ||
of radius | |||
[________________________]{$answer} | |||
$ | |||
[@ helpLink('equation') @]* | |||
END_PGML | |||
</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> | ||
</p> | </p> | ||
</td> | </td> | ||
Line 148: | Line 130: | ||
<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(); | ||
Line 173: | Line 150: | ||
[[Category:Top]] | [[Category:Top]] | ||
[[Category:Sample Problems]] | [[Category:Sample Problems]] | ||
[[Category:Subject Area Templates]] | [[Category:Subject Area Templates]] |
Latest revision as of 09:43, 18 July 2023
This problem has been replaced with a newer version of this problem
Answer is an Equation that Implicitly Defines a Function

This PG code shows how to have an answer that is an equation that implicitly defines a function.
- PGML location in OPL: FortLewis/Authoring/Templates/Algebra/EquationImplicitFunction1_PGML.pg
PG problem file | Explanation |
---|---|
Problem tagging: |
|
DOCUMENT(); loadMacros('PGstandard.pl','MathObjects.pl', 'parserImplicitEquation.pl','PGML.pl','PGcourse.pl'); TEXT(beginproblem()); |
Initialization: |
Context('ImplicitEquation'); Context()->{error}{msg}{ "Can't find any solutions to your equation"} = ' '; Context()->{error}{msg}{ "Can't generate enough valid points for comparison"} = ' '; Context()->variables->set( x=>{limits=>[-6,11]}, y=>{limits=>[-6,11]}, ); $a = random(1,5,1); $b = random(1,5,1); $r = random(2,5,1); $p = Compute("($a,$b)"); $answer = ImplicitEquation( "(x-$a)^2 + (y-$b)^2 = $r^2", solutions=>[ [$a,$b+$r], [$a,$b-$r], [$a+$r,$b], [$a-$r,$b], [$a+$r*sqrt(2)/2,$b+$r*sqrt(2)/2], ] ); |
Setup:
We quash some error messages by redefining them to be a blank string
If your equation is linear of the form |
BEGIN_PGML Enter an equation for a circle in the [`xy`]-plane of radius [` [$r] `] centered at [` [$p] `]. [________________________]{$answer} [@ helpLink('equation') @]* END_PGML |
Main Text: |
BEGIN_PGML_SOLUTION Solution explanation goes here. END_PGML_SOLUTION ENDDOCUMENT(); |
Solution: |