ImplicitPlane1

From WeBWorK_wiki
Revision as of 11:02, 10 March 2023 by Pstaabp (talk | contribs) (Removes the AnswerFormatHelp macro and some other cleanup.)
Jump to navigation Jump to search

Answer is an Equation for a Line or Plane

Click to enlarge

This PG code shows how to define an answer that is a line or plane.


Templates by Subject Area

PG problem file Explanation

Problem tagging data

Problem tagging:

DOCUMENT();   

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

TEXT(beginproblem());

Initialization:

  • The parserVectorUtils.pl macro is used for the non_zero_point3D function below.
  • The parserImplicitPlane.pl macro includes the context and the ImplicitPlane function to parse and create implicit planes.

Context('ImplicitPlane');
Context()->variables->are(x=>'Real',y=>'Real', z=> 'Real');

$A = non_zero_point3D(-5,5,1);
$N = non_zero_vector3D(-5,5,1);

$answer1 = ImplicitPlane($A,$N);
$answer2 = ImplicitPlane('4x+3y=12');
$answer3 = ImplicitPlane('x=3');

Setup: The first answer is a standard mulitivariable calculus question. There are several different ways to specify the input to ImplicitPlane, which are detailed in the POD documentation. It is also possible to do some more complicated manipulations with the vectors and points, which is detailed in the problem techniques section.

When the ImplicitPlane context has only two variables, it rephrases error messages in terms of lines. If you want students to be able to enter an equation for a line in the most general form, or if you have a vertical line to check (or just a constant equation such as x=3), you can use the ImplicitPlane context to reliably check these answers.

BEGIN_PGML
a. Enter an equation for the plane through the point [` [$A] `] and perpendicular to [` [$N] `].

    + [______________]{$answer1}

b. Enter an equation for the line in the [` xy `]-plane with [` x `]-intercept [` 3 `] and [` y `]-intercept [` 4 `].

    + [______________]{$answer2}

c. Enter an equation for the vertical line in the [` xy `]-plane through the point [` (3,1) `].

    + [______________]{$answer3}

[@ helpLink('equation') @]*
END_PGML

Main Text:

BEGIN_PGML_SOLUTION
Solution explanation goes here.
END_PGML_SOLUTION

Solution:

Templates by Subject Area