Difference between revisions of "ImplicitPlane"
Jump to navigation
Jump to search
m |
m |
||
Line 1: | Line 1: | ||
− | <h2>Planes Defined Implicitly</h2> |
+ | <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;"> |
||
Line 51: | Line 51: | ||
$B = Point($A + $AB); |
$B = Point($A + $AB); |
||
$C = Point($A + $AC); |
$C = Point($A + $AC); |
||
+ | |||
+ | $answer = ImplicitPlane($A,$N); |
||
</pre> |
</pre> |
||
</td> |
</td> |
||
Line 57: | Line 59: | ||
<b>Setup:</b> |
<b>Setup:</b> |
||
Create points and vectors. Make sure that the vectors are not parallel. |
Create points and vectors. Make sure that the vectors are not parallel. |
||
+ | </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 65: | Line 76: | ||
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 82: | Line 91: | ||
<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; |
||
Revision as of 19:36, 6 February 2010
Planes or Lines Defined Implicitly
This shows the PG code to evaluate answers that are planes or lines defined implicitly by an equation.
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. 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.html
- PG macro code: parserImplicitPlane.pl
- POD documentation: parserVectorUtils.pl.html
- PG macro code: parserVectorUtils.pl