Difference between revisions of "Infinity (MathObject Class)"

From WeBWorK_wiki
Jump to navigation Jump to search
(Add headings and update answer checkers, properties, and methods)
m
Line 29: Line 29:
 
=== Methods ===
 
=== Methods ===
   
As with all MathObjects, the Infinity object supports the [[MathObject_Methods_and_Properties| common MathObject methods]]. There are no additional methods for this class.
+
The Infinity object supports the [[MathObject_Methods_and_Properties| common MathObject methods]]. There are no additional methods for this class.
   
   
 
=== Properties ===
 
=== Properties ===
   
As with all MathObjects, the Infinity object supports the [[MathObject_Methods_and_Properties| common MathObject properties]], and the following additional ones:
+
The Infinity object supports the [[MathObject_Methods_and_Properties| common MathObject properties]], and the following additional ones:
   
 
{| class="wikitable"
 
{| class="wikitable"

Revision as of 12:33, 4 August 2012

Infinity Class

The Infinity class handles the positive infinity of the extended reals. This value can be negated and used in intervals, but can be added to Reals (or other MathObjects) and can't be used as an argument to functions like sin() or sqrt(). Infinity can be created in any Context, though Numeric context is commonly used.


Creation

In Perl code, you can use Infinity to obtain this value, or -(Infinity) to obtain its negation. E.g.,

   Context("Numeric");
   
   $Inf = Infinity;
   $MInf = -(Infinity);
   
   Context("Interval");
   $I = Interval("(",0,Infinity,"]");   # but easier as Interval("(0,infinity]");


Answer Checker

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

   ANS(Infinity->cmp);
   ANS((-(Infinity))->cmp);

The Infinity class supports the common answer-checker options. There are no additional options.


Methods

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


Properties

The Infinity object supports the common MathObject properties, and the following additional ones:

Property Description
$r->{isNegative} True when the object represents -Infinity, false otherwise. You should not set this value yourself.