Difference between revisions of "Point (MathObject Class)"

From WeBWorK_wiki
Jump to navigation Jump to search
(Created page)
 
(Add section titles, and answer checker, method, and property information)
Line 1: Line 1:
== The Point Class ==
+
=== Point Class ===
   
The Point class implements points in <math>{\bf R}^n</math> for arbitrary <math>n</math>. Typically, Points are delimited by parentheses, but that can be controlled by settings in the Context. Points (of the same dimension) can be added and subtracted, or multiplied and divided by scalars. The answer checker for Points can give students hints about the coordinates that are wrong, and about whether the number of coordinates is correct.
+
The Point class implements points in <math>{\bf R}^n</math> for arbitrary <math>n</math>. Typically, Points are delimited by parentheses, but that can be controlled by settings in the Context. Points are typically used in the <code>Point</code> or <code>Vector</code> Contexts, though they are also available in <code>Matrix</code> Context. It is possible to create Points in <math>{\bf C}^n</math>, though there is no pre-defined Context that makes this easy to do.
  +
  +
=== Creation ===
  +
  +
Points (of the same dimension) can be added and subtracted, or multiplied and divided by scalars. The answer checker for Points can give students hints about the coordinates that are wrong, and about whether the number of coordinates is correct.
   
 
Context("Point");
 
Context("Point");
Line 15: Line 15:
 
$p = $p/2; # same as Point(3/2,0,-1);
 
$p = $p/2; # same as Point(3/2,0,-1);
   
It is possible to create Points in <math>{\bf C}^n</math>, though there is no pre-defined Context that makes this easy to do.
 
  +
  +
=== Answer Checker ===
  +
  +
As with all MathObjects, you obtain an answer checker for a Point object via the <code>cmp()</code> method:
  +
  +
ANS(Compute("(4,0,-2)")->cmp);
  +
  +
The Point class supports the [[Answer_Checker_Options_(MathObjects)| common answer-checker options]], and the following additional options:
  +
  +
{| class="wikitable"
  +
! Option !! Description !! style="padding:5px" | Default
  +
|- style="vertical-align: top"
  +
| style="padding: 5px; white-space: nowrap" | <code>showDimensionHints => 1</code> or <code>0</code>
  +
| style="padding: 5px" | Show/don't show messages about the wrong number of coordinates.
  +
| style="text-align:center" | <code>1</code>
  +
|- style="vertical-align: top"
  +
| style="padding: 5px; white-space: nowrap" | <code>showCoordinateHints => 1</code> or <code>0</code>
  +
| style="padding: 5px" | Show/don't show message about which coordinates are right.
  +
| style="text-align:center" | <code>1</code>
  +
|}
  +
  +
  +
=== Methods ===
  +
  +
The Point class supports the [[MathObject_Methods_and_Properties| common MathObject methods]]. There are no additional methods for this class.
  +
  +
  +
=== Properties ===
  +
  +
The Point class supports the [[MathObject_Methods_and_Properties| common MathObject properties]]. There are no additional properties for this class.
  +
   
 
<br>
 
<br>

Revision as of 13:20, 4 August 2012

Point Class

The Point class implements points in [math]{\bf R}^n[/math] for arbitrary [math]n[/math]. Typically, Points are delimited by parentheses, but that can be controlled by settings in the Context. Points are typically used in the Point or Vector Contexts, though they are also available in Matrix Context. It is possible to create Points in [math]{\bf C}^n[/math], though there is no pre-defined Context that makes this easy to do.

Creation

Points (of the same dimension) can be added and subtracted, or multiplied and divided by scalars. The answer checker for Points can give students hints about the coordinates that are wrong, and about whether the number of coordinates is correct.

   Context("Point");
   
   $p = Point(3,0,-2);
   $p = Point([3,0,-2]);
   $p = Point("(3,0,-2)");
   $p = Compute("(3,0,-2)");
   
   $q = $p + Point(1,3,7);   # same as Point(4,3,5);
   $q = $p + [1,3,7];        # same as above
   $q = 3*$p;                # same as Point(9,0,-6);
   $p = $p/2;                # same as Point(3/2,0,-1);


Answer Checker

As with all MathObjects, you obtain an answer checker for a Point object via the cmp() method:

   ANS(Compute("(4,0,-2)")->cmp);

The Point class supports the common answer-checker options, and the following additional options:

Option Description Default
showDimensionHints => 1 or 0 Show/don't show messages about the wrong number of coordinates. 1
showCoordinateHints => 1 or 0 Show/don't show message about which coordinates are right. 1


Methods

The Point class supports the common MathObject methods. There are no additional methods for this class.


Properties

The Point class supports the common MathObject properties. There are no additional properties for this class.