Difference between revisions of "ImplicitPlane"

From WeBWorK_wiki
Jump to navigation Jump to search
(Update documentation links)
Line 62: Line 62:
 
<b>Setup:</b>
 
<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
 
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_TRUNK/macros/parserImplicitPlane.pl.html parserImplicitPlane.pl.html]
+
[http://webwork.maa.org/pod/pg/macros/parserImplicitPlane.html parserImplicitPlane.pl]
 
</p>
 
</p>
 
<p>
 
<p>
Line 116: Line 116:
   
 
<ul>
 
<ul>
<li>POD documentation: [http://webwork.maa.org/pod/pg_TRUNK/macros/parserImplicitPlane.pl.html parserImplicitPlane.pl.html]</li>
+
<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>
 
<li>PG macro code: [http://webwork.maa.org/viewvc/system/trunk/pg/macros/parserImplicitPlane.pl?view=log parserImplicitPlane.pl]</li>
 
</ul>
 
</ul>
Line 123: Line 123:
   
 
<ul>
 
<ul>
<li>POD documentation: [http://webwork.maa.org/pod/pg_TRUNK/macros/parserVectorUtils.pl.html parserVectorUtils.pl.html]</li>
+
<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>
 
<li>PG macro code: [http://webwork.maa.org/viewvc/system/trunk/pg/macros/parserVectorUtils.pl?view=log parserVectorUtils.pl]</li>
 
</ul>
 
</ul>

Revision as of 18:04, 7 April 2021

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

Problem Techniques Index

PG problem file Explanation
DOCUMENT(); 

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

TEXT(beginproblem());

Initialization: In particular, we need to include the parserImplicitPlane.pl macro file, which automatically loads MathObjects.pl.

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.

Problem Techniques Index