Difference between revisions of "PointsInAnswers"

From WeBWorK_wiki
Jump to navigation Jump to search
(Update documentation links)
m (fix link)
Line 132: Line 132:
<li>POD documentation: [http://webwork.maa.org/doc/cvs/pg_CURRENT/doc/MathObjects/MathObjectsAnswerCheckers.html MathObjectsAnswerCheckers.html]</li>
<li>POD documentation: [http://webwork.maa.org/pod/pg_TRUNK/doc/MathObjects/MathObjectsAnswerCheckers.html MathObjectsAnswerCheckers.html]</li>

Revision as of 13:57, 7 December 2019

Points in Student Answers

This PG code shows how to check student answers that are points.

Problem Techniques Index

PG problem file Explanation



Initialization: We load the contextLimitedPoint.pl macro which automatically loads MathObjects.pl. The LimitedPoint context does not allow operations between points.

Alternatively, instead of loading contextLimitedPoint.pl, we could have loaded MathObjects.pl and parserVectorUtils.pl. This would allow operations, such as addition and subtraction, between points.


$f = Formula("2-x");

$xint = Point("(2,0)");
$yint = Point("(0,2)");

Setup: Everything is as usual. The LimitedPoint context does not allow operations among points (such as adding, etc.). We could have used Context("Point"); instead.

Alternatively, if we had loaded parserVectorUtils.pl, we would use Context("Vector2D"); for two-dimensional space or Context("Vector"); for three-dimensional space.

If \( y = f(x) = $f \), find the x- and y-intercepts.  
Enter your answers as points \( (a,b) \) that include parentheses.
x-intercept: \{ ans_rule(15) \}
y-intercept: \{ ans_rule(15) \}

Main Text: The main text section of the file is as we'd expect.

ANS( $xint->cmp() );
ANS( $yint->cmp() );


Answer Evaluation: We can control the hints students receive using cmp(showDimensionHints=>1, showCoordinateHints=>1). For all options, see "Flags for Point()->cmp" on MathObjectsAnswerCheckers.html

Problem Techniques Index