Difference between revisions of "ImplicitPlane"
(add historical tag and give links to newer problems.) |
|||
(23 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | <h2>Planes Defined Implicitly: PG Code Snippet</h2> |
||
+ | {{historical}} |
||
+ | |||
+ | <p style="font-size: 120%;font-weight:bold">This problem has been replaced with [https://openwebwork.github.io/pg-docs/sample-problems/DiffCalcMV/ImplicitPlane.html a newer version of this problem]</p> |
||
+ | |||
+ | |||
+ | <h2>Planes or Lines Defined Implicitly</h2> |
||
<p style="background-color:#eeeeee;border:black solid 1px;padding:3px;"> |
<p style="background-color:#eeeeee;border:black solid 1px;padding:3px;"> |
||
− | <em>This |
+ | <em>This shows the PG code to evaluate answers that are planes or lines defined implicitly by an equation. |
+ | <br /> |
||
+ | <br /> |
||
+ | You may also be interested in [http://webwork.maa.org/wiki/EquationsDefiningFunctions EquationsDefiningFunctions]</em> |
||
</p> |
</p> |
||
Line 8: | Line 13: | ||
[[IndexOfProblemTechniques|Problem Techniques Index]] |
[[IndexOfProblemTechniques|Problem Techniques Index]] |
||
</p> |
</p> |
||
+ | |||
<table cellspacing="0" cellpadding="2" border="0"> |
<table cellspacing="0" cellpadding="2" border="0"> |
||
<tr valign="top"> |
<tr valign="top"> |
||
Line 19: | Line 25: | ||
loadMacros( |
loadMacros( |
||
− | + | "PGstandard.pl", |
|
− | + | "parserImplicitPlane.pl", |
|
− | + | "parserVectorUtils.pl", |
|
− | + | "PGcourse.pl", |
|
− | "parserVectorUtils.pl", |
||
− | "PGcourse.pl", |
||
); |
); |
||
− | TEXT(beginproblem); |
+ | TEXT(beginproblem()); |
</pre> |
</pre> |
||
</td> |
</td> |
||
<td style="background-color:#ccffcc;padding:7px;"> |
<td style="background-color:#ccffcc;padding:7px;"> |
||
<p> |
<p> |
||
− | Initialization: In particular, we need to include the <code>parserImplicitPlane.pl</code> macro file. |
||
+ | <b>Initialization:</b> |
||
+ | In particular, we need to include the <code>parserImplicitPlane.pl</code> macro file, which automatically loads <code>MathObjects.pl</code>. |
||
</p> |
</p> |
||
</td> |
</td> |
||
Line 40: | Line 47: | ||
# Vectors in the plane |
# Vectors in the plane |
||
$AB = non_zero_vector3D(); |
$AB = non_zero_vector3D(); |
||
− | $AC = non_zero_vector3D(); |
+ | $AC = non_zero_vector3D(); |
+ | while (areParallel $AB $AC) {$AC = non_zero_vector3D()} |
||
# The normal vector |
# The normal vector |
||
− | $N = cross $AB $AC; |
+ | $N = cross $AB $AC; # or $N = $AB x $AC; |
# The points A, B and C |
# The points A, B and C |
||
$A = non_zero_point3D(); |
$A = non_zero_point3D(); |
||
$B = Point($A + $AB); |
$B = Point($A + $AB); |
||
$C = Point($A + $AC); |
$C = Point($A + $AC); |
||
+ | |||
+ | $answer = ImplicitPlane($A,$N); |
||
</pre> |
</pre> |
||
</td> |
</td> |
||
<td style="background-color:#ffffcc;padding:7px;"> |
<td style="background-color:#ffffcc;padding:7px;"> |
||
<p> |
<p> |
||
− | Set-up: Create points and vectors. Make sure that the vectors are not parallel. |
||
+ | <b>Setup:</b> |
||
+ | Create points and vectors. Make sure that the vectors are not parallel. There are several other ways to define planes implicitly, which are explained at |
||
+ | [http://webwork.maa.org/pod/pg/macros/parserImplicitPlane.html parserImplicitPlane.pl] |
||
+ | </p> |
||
+ | <p> |
||
+ | If the correct answer is a line in 2D space instead of a plane in 3D space, the only modification needed is to reduce the number of variables to two, which will modify error messages accordingly. |
||
+ | <pre> |
||
+ | Context("ImplicitPlane"); |
||
+ | Context()->variables->are(x=>"Real",y=>"Real"); |
||
+ | |||
+ | $answer = ImplicitPlane("y=4x+3"); |
||
+ | </pre> |
||
</p> |
</p> |
||
</td> |
</td> |
||
Line 61: | Line 81: | ||
Context()->texStrings; |
Context()->texStrings; |
||
BEGIN_TEXT |
BEGIN_TEXT |
||
− | |||
An implicit equation for the plane passing through the points |
An implicit equation for the plane passing through the points |
||
\($A\), \($B\), and \($C\) is \{ans_rule(40)\}. |
\($A\), \($B\), and \($C\) is \{ans_rule(40)\}. |
||
− | |||
END_TEXT |
END_TEXT |
||
Context()->normalStrings; |
Context()->normalStrings; |
||
Line 70: | Line 88: | ||
<td style="background-color:#ffcccc;padding:7px;"> |
<td style="background-color:#ffcccc;padding:7px;"> |
||
<p> |
<p> |
||
− | Question: self-explanatory. |
||
+ | <b>Main Text:</b> |
||
+ | Self-explanatory. |
||
</p> |
</p> |
||
</td> |
</td> |
||
Line 77: | Line 96: | ||
<td style="background-color:#eeddff;border:black 1px dashed;"> |
<td style="background-color:#eeddff;border:black 1px dashed;"> |
||
<pre> |
<pre> |
||
− | ANS( |
+ | ANS( $answer->cmp ); |
$showPartialCorrectAnswers = 1; |
$showPartialCorrectAnswers = 1; |
||
Line 84: | Line 103: | ||
<td style="background-color:#eeccff;padding:7px;"> |
<td style="background-color:#eeccff;padding:7px;"> |
||
<p> |
<p> |
||
− | Answer Evaluation: |
+ | <b>Answer Evaluation:</b> |
+ | Just specify a point $A and a normal vector $N. |
||
</p> |
</p> |
||
</td> |
</td> |
||
Line 93: | Line 112: | ||
[[IndexOfProblemTechniques|Problem Techniques Index]] |
[[IndexOfProblemTechniques|Problem Techniques Index]] |
||
</p> |
</p> |
||
+ | |||
+ | |||
+ | |||
+ | <ul> |
||
+ | <li>POD documentation: [http://webwork.maa.org/pod/pg/macros/parserImplicitPlane.html parserImplicitPlane.pl]</li> |
||
+ | <li>PG macro code: [http://webwork.maa.org/viewvc/system/trunk/pg/macros/parserImplicitPlane.pl?view=log parserImplicitPlane.pl]</li> |
||
+ | </ul> |
||
+ | |||
+ | |||
+ | |||
+ | <ul> |
||
+ | <li>POD documentation: [http://webwork.maa.org/pod/pg/macros/parserVectorUtils.html parserVectorUtils.pl]</li> |
||
+ | <li>PG macro code: [http://webwork.maa.org/viewvc/system/trunk/pg/macros/parserVectorUtils.pl?view=log parserVectorUtils.pl]</li> |
||
+ | </ul> |
||
[[Category:Problem Techniques]] |
[[Category:Problem Techniques]] |
Latest revision as of 11:12, 16 July 2023
This problem has been replaced with a newer version of this problem
Planes or Lines Defined Implicitly
This shows the PG code to evaluate answers that are planes or lines defined implicitly by an equation.
You may also be interested in EquationsDefiningFunctions
PG problem file | Explanation |
---|---|
DOCUMENT(); loadMacros( "PGstandard.pl", "parserImplicitPlane.pl", "parserVectorUtils.pl", "PGcourse.pl", ); TEXT(beginproblem()); |
Initialization:
In particular, we need to include the |
Context("ImplicitPlane"); # Vectors in the plane $AB = non_zero_vector3D(); $AC = non_zero_vector3D(); while (areParallel $AB $AC) {$AC = non_zero_vector3D()} # The normal vector $N = cross $AB $AC; # or $N = $AB x $AC; # The points A, B and C $A = non_zero_point3D(); $B = Point($A + $AB); $C = Point($A + $AC); $answer = ImplicitPlane($A,$N); |
Setup: Create points and vectors. Make sure that the vectors are not parallel. There are several other ways to define planes implicitly, which are explained at parserImplicitPlane.pl If the correct answer is a line in 2D space instead of a plane in 3D space, the only modification needed is to reduce the number of variables to two, which will modify error messages accordingly. Context("ImplicitPlane"); Context()->variables->are(x=>"Real",y=>"Real"); $answer = ImplicitPlane("y=4x+3"); |
Context()->texStrings; BEGIN_TEXT An implicit equation for the plane passing through the points \($A\), \($B\), and \($C\) is \{ans_rule(40)\}. END_TEXT Context()->normalStrings; |
Main Text: Self-explanatory. |
ANS( $answer->cmp ); $showPartialCorrectAnswers = 1; ENDDOCUMENT(); |
Answer Evaluation: Just specify a point $A and a normal vector $N. |
- POD documentation: parserImplicitPlane.pl
- PG macro code: parserImplicitPlane.pl
- POD documentation: parserVectorUtils.pl
- PG macro code: parserVectorUtils.pl