Difference between revisions of "ImplicitPlane"

From WeBWorK_wiki
Jump to navigation Jump to search
m
m
Line 1: Line 1:
<h2>Planes Defined Implicitly: PG Code Snippet</h2>
+
<h2>Planes 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 code snippet shows the PG code to evaluate answers that are planes defined implicitly by an equation.</em>
+
<em>This shows the PG code to evaluate answers that are planes defined implicitly by an equation.</em>
 
</p>
 
</p>
   
Line 31: Line 31:
 
<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.
 
</p>
 
</p>
 
</td>
 
</td>
Line 41: Line 42:
 
# Vectors in the plane
 
# Vectors in the plane
 
$AB = non_zero_vector3D();
 
$AB = non_zero_vector3D();
$AC = non_zero_vector3D(); while (areParallel $AB $AC) {$AC = non_zero_vector3D()}
+
$AC = non_zero_vector3D();
  +
while (areParallel $AB $AC) {$AC = non_zero_vector3D()}
   
 
# The normal vector
 
# The normal vector
Line 53: Line 54:
 
<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.
 
</p>
 
</p>
 
</td>
 
</td>
Line 71: Line 73:
 
<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 85: Line 88:
 
<td style="background-color:#eeccff;padding:7px;">
 
<td style="background-color:#eeccff;padding:7px;">
 
<p>
 
<p>
Answer Evaluation: Just specify a point $A and a normal vector $N.
+
<b>Answer Evaluation:</b>
  +
Just specify a point $A and a normal vector $N.
 
</p>
 
</p>
 
</td>
 
</td>

Revision as of 17:56, 22 January 2010

Planes Defined Implicitly

This shows the PG code to evaluate answers that are planes defined implicitly by an equation.

Problem Techniques Index

PG problem file Explanation
DOCUMENT(); 

loadMacros(
  "PGstandard.pl",
  "MathObjects.pl",
  "parserImplicitPlane.pl",
  "parserVectorUtils.pl",
  "PGcourse.pl",
);

TEXT(beginproblem);

Initialization: In particular, we need to include the parserImplicitPlane.pl macro file.

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);

Setup: Create points and vectors. Make sure that the vectors are not parallel.

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(ImplicitPlane($A,$N)->cmp);
$showPartialCorrectAnswers = 1;

ENDDOCUMENT();

Answer Evaluation: Just specify a point $A and a normal vector $N.

Problem Techniques Index