Difference between revisions of "Infinity (MathObject Class)"

From WeBWorK_wiki
Jump to navigation Jump to search
m (moved MathObjects Infinity to Infinity (MathObjets Class): Better alphabetizing of class pages)
m (Update Properties Link)
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
== The Infinity Class ==
+
=== 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 <code>sin()</code> or <code>sqrt()</code>. In Perl code, you can use <code>Infinity</code> to obtain this value, or <code>-(Infinity)</code> to obtain its negation. E.g.,
+
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 <code>sin()</code> or <code>sqrt()</code>. Infinity can be created in any Context, though <code>Numeric</code> context is commonly used.
  +
  +
  +
=== Creation ===
  +
  +
In Perl code, you can use <code>Infinity</code> to obtain this value, or <code>-(Infinity)</code> to obtain its negation. E.g.,
   
 
Context("Numeric");
 
Context("Numeric");
Line 7: Line 7:
 
$Inf = Infinity;
 
$Inf = Infinity;
 
$MInf = -(Infinity);
 
$MInf = -(Infinity);
$I = Interval("(",0,Infinity,"]"); # easier as Interval("(0,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 <code>cmp()</code> method:
  +
  +
ANS(Infinity->cmp);
  +
ANS((-(Infinity))->cmp);
  +
  +
The Infinity class supports the [[Answer_Checker_Options_(MathObjects)| common answer-checker options]]. There are no additional options.
  +
  +
  +
=== Methods ===
  +
  +
The Infinity class supports the [[Common MathObject Methods]]. There are no additional methods for this class.
  +
  +
  +
=== Properties ===
  +
  +
The Infinity class supports the [[Common MathObject Properties]], and the following additional ones:
  +
  +
{| class="wikitable"
  +
! Property !! Description
  +
|- style="vertical-align: baseline"
  +
| style="padding: 5px; white-space: nowrap" | <code>$r->{isNegative}</code>
  +
| style="padding: 5px" | True when the object represents <code>-Infinity</code>, false otherwise. You should not set this value yourself.
  +
|}
  +
   
  +
<br>
   
 
[[Category:MathObject_Classes]]
 
[[Category:MathObject_Classes]]

Latest revision as of 04:32, 6 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 class supports the Common MathObject Methods. There are no additional methods for this class.


Properties

The Infinity class 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.