Difference between revisions of "DigitsTolType"

From WeBWorK_wiki
Jump to navigation Jump to search
Line 47: Line 47:
 
<td style="background-color:#ffffdd;border:black 1px dashed;">
 
<td style="background-color:#ffffdd;border:black 1px dashed;">
 
<pre>
 
<pre>
Context("Numeric")->flags->set(tolType=>'digits',tolerateTruncation=>0);
+
Context("Numeric")->flags->set(tolType=>'digits',tolDigits => 3, tolerateTruncation=>0);
 
</pre>
 
</pre>
 
</td>
 
</td>
Line 55: Line 55:
 
<ul>
 
<ul>
 
<li>The <pre>tolType=>'digits'</pre> switch to the digits tolerance. </li>
 
<li>The <pre>tolType=>'digits'</pre> switch to the digits tolerance. </li>
  +
<li> The <pre>tolDigits=>3</pre> sets the number of digits to 3 (the default)</li>
  +
<li> The <pre>tolerateTruncation</pre> parameter is either 1 (true) or 0 (false).
  +
<li>
 
</ul>
 
</ul>
 
</p>
 
</p>

Revision as of 17:31, 28 April 2021

Construction.png This article is under construction. Use the information herein with caution until this message is removed.

Digits TolType


This describes an alternative way for determining the tolerance type based on the number of digits.

Problem Techniques Index

PG problem file Explanation
DOCUMENT();
loadMacros(
  "PGstandard.pl",
  "MathObjects.pl",
  "PGML.pl"
);
TEXT(beginproblem());

Initialization: This is built-in to MathObjects.

Context("Numeric")->flags->set(tolType=>'digits',tolDigits => 3, tolerateTruncation=>0);

Setup:

  • The
    tolType=>'digits'
    switch to the digits tolerance.
  • The
    tolDigits=>3
    sets the number of digits to 3 (the default)
  • The
    tolerateTruncation
    parameter is either 1 (true) or 0 (false).

BEGIN_PGML
Graph the circle given by the following equation.

	[`[$circle_eq_lhs] = [$r ** 2]`]

[_]{$gt}
END_PGML

Main Text: This asks to graph the circle given by the equation. And the code:

[_]{$gt}

inserts the GraphTool.

BEGIN_PGML_SOLUTION
The equation of the circle of the form:

[`[$circle_eq_lhs] = [$r ** 2]`]

has a center at [`([$h],[$k])`] and radius [$r].   To enter the graph, click the circle tool, then click the center at [`([$h],[$k])`] and then click a second point that is [$r] units from the center.  This is easist going left, right, up or down from the center.
END_PGML_SOLUTION

ENDDOCUMENT();

This is the solution.

Problem Techniques Index


  • POD documentation: [1]