UnaryPredicates - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


RealBox

  

UnaryPredicates

  

unary predicates for RealBox objects

  

IsZero

  

check whether a RealBox is zero

  

IsNonzero

  

check whether a RealBox is nonzero

  

IsOne

  

check whether a RealBox is one

  

IsFinite

  

check whether a RealBox is finite

  

IsExact

  

check whether a RealBox is exact

  

IsInteger

  

check whether a RealBox is an integer

  

IsPositive

  

check whether a RealBox is positive

  

IsNegative

  

check whether a RealBox is negative

  

IsNonPositive

  

check whether a RealBox is non-positive

  

IsNonNegative

  

check whether a RealBox is non-negative

  

HasInteger

  

check whether a RealBox contains an integer value

  

HasZero

  

check whether a RealBox contains the value zero

  

HasPositive

  

check whether a RealBox contains a positive value

  

HasNegative

  

check whether a RealBox contains a negative value

  

HasNonNegative

  

check whether a RealBox contains a non-negative value

  

HasNonPositive

  

check whether a RealBox contains a non-positive value

  

IsInfinity

  

check whether a RealBox is positive infinity

  

IsNegInfinity

  

check whether a RealBox is negative infinity

  

IsUndefined

  

check whether a RealBox is undefined

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

IsZero( b )

IsNonzero( b )

IsOne( b )

IsFinite( b )

IsExact( b )

IsInteger( b )

IsPositive( b )

IsNegative( b )

IsNonPositive( b )

IsNonNegative( b )

IsUndefined( b )

IsInfinity( b )

IsNegInfinity( b )

HasInteger( b )

HasZero( b )

HasPositive( b )

HasNegative( b )

HasNonNegative( b )

HasNonPositive( b )

Parameters

b

-

RealBox object

precopt

-

(optional) equation of the form precision = n, where n is a positive integer

Description

• 

Each RealBox object defines a number of predicates that can be used to query various properties of the box.

• 

Predicates may be further sub-divided into unary predicates (of a single RealBox object) or binary (for comparing two RealBox objects).

• 

The following table describes briefly the unary predicate methods defined for RealBox objects.

Predicate

Description

IsZero

returns true if the RealBox represents an exact zero (center and radius are both 0)

IsNonzero

returns true if the RealBox does not contain 0

IsOne

returns true if the RealBox represents 1 exactly

IsFinite

returns true if the RealBox has finite center and radius

IsExact

returns true if the RealBox has zero radius

IsInteger

returns true if the RealBox has zero radius and integer center

IsPositive

returns true if every member of the RealBox is positive (false if it contains undefined)

IsNegative

returns true if every member of the RealBox is negative (false if it contains undefined)

IsNonNegative

returns true if every member of the RealBox is non-negative (false if it contains undefined)

IsNonPositive

returns true if every member of the RealBox is non-positive (false if it contains undefined)

IsInfinity

returns true if the RealBox is positive infinity

IsNegInfinity

returns true if the RealBox is negative infinity

IsUndefined

returns true if the RealBox is an undefined (NaN)

HasInteger

returns true if the RealBox contains an integer value

HasZero

returns true if the RealBox contains 0

HasPositive

returns true if the RealBox contains a positive value

HasNegative

returns true if the RealBox contains a negative value

HasNonNegative

returns true if the RealBox contains a non-negative value

HasNonPositive

returns true if the RealBox contains a non-positive value

• 

Use the 'precision' = n option to control the precision used in these methods. For more details on precision, see BoxPrecision.

Examples

The following results are not surprising.

IsZeroRealBox0

true

(1)

IsZeroRealBox0.

true

(2)

This returns false because the box is not an exact zero.

IsZeroRealBox0.,1.×10−30

false

(3)

Clearly, 0 is contained in the following box.

IsNonzeroRealBox0.,1.×10−30

false

(4)

That zero belongs to the next box is due to the box being closed.

IsNonzeroRealBox1.×10−30,1.×10−30

false

(5)

IsNonzeroRealBox1.×10−30,1.×10−31

true

(6)

IsOneRealBox1

true

(7)

IsOneRealBox1.0

true

(8)

This returns false because the box is not an exact box.

IsOneRealBox1.0,1.×10−30

false

(9)

IsFiniteRealBox2.3

true

(10)

A box is not finite despite having a finite center if its radius is infinite.

IsFiniteRealBox2.3,

false

(11)

Negative infinities are also not "finite".

IsFiniteRealBox

false

(12)

IsFiniteRealBoxFloat

false

(13)

Undefined values for the center also cause the IsFinite method to return false.

IsFiniteRealBoxundefined

false

(14)

The IsExact method checks that a RealBox object represents its center exactly in the sense that that radius is equal to 0.

IsExactRealBox0.5

true

(15)

IsExactRealBox0.5,1.×10−50

false

(16)

IsExactRealBox

true

(17)

IsExactRealBox

true

(18)

IsExactRealBoxundefined

false

(19)

Whether a RealBox object is exact may depend not only on the passed radius (which is 0 by default), but also on the representability of the center as an exact float. In these examples, the rational number 32 can be represented exactly as a float, while 23 cannot.

IsExactRealBox32

true

(20)

IsExactRealBox23

false

(21)

Notice that IsInteger returns true only if the RealBox is exact in the sense that the radius is equal to 0.

IsIntegerRealBox44

true

(22)

IsIntegerRealBox44,1.×10−40

false

(23)

Of course, it returns false for (exact) non-integral values.

IsIntegerRealBox32

false

(24)

IsIntegerRealBox

false

(25)

IsIntegerRealBox

false

(26)

IsIntegerRealBoxundefined

false

(27)

The following returns true because the default user-specified radius of zero results in an ultimate radius that is very small relative to the size of the center.

IsPositiveRealBox0.0001

true

(28)

RadiusRealBox0.0001

7.10542735760100×10−15

(29)

Here, the radius is larger than the center, so the box represents a set containing non-positive values.

IsPositiveRealBox0.0001,0.001

false

(30)

Similar results are obtained for testing whether a box is "negative".

IsNegativeRealBox0.001

false

(31)

IsNegativeRealBox0.001

true

(32)

IsNegativeRealBox0.001,0.02

false

(33)

IsNonNegativeRealBox0

true

(34)

IsNonNegativeRealBox0,1.×10−34

false

(35)

IsNonNegativeRealBox1.×10−34,1.×10−35

true

(36)

IsNonNegativeRealBox1.×10−34,1.×10−34

false

(37)

IsNonPositiveRealBox0

true

(38)

Note the result for a negative zero:

IsNonPositiveRealBox0.

true

(39)

IsNonPositiveRealBox0,1.×10−20

false

(40)

IsNonPositiveRealBox1.×10−20,1.×10−20

false

(41)

IsNonPositiveRealBox1.×10−20,1.×10−21

true

(42)

HasIntegerRealBox0

true

(43)

HasIntegerRealBox0,1.×10−30

true

(44)

HasIntegerRealBox273.15,0.00001

false

(45)

HasIntegerRealBox273.15,0.2

true

(46)

HasIntegerRealBox808017424794512875886459904961710757005754368000000000,1.×10−40

true

(47)

HasIntegerRealBox106!,1.×10−1000

true

(48)

HasZeroRealBox0

true

(49)

HasZeroRealBox0.

true

(50)

HasZeroRealBox1.×10−30,1.×10−31

false

(51)

HasZeroRealBox1.×10−30,1.×10−30

true

(52)

HasPositiveRealBox0

false

(53)

HasPositiveRealBox0,1.×10−30

true

(54)

HasPositiveRealBox1.×10−29,1.×10−30

false

(55)

Because neither the center nor radius can be represented exactly in floating point, the following returns true.

HasPositiveRealBox1.×10−20,1.×10−20

true

(56)

Similarly, we have the following result.

HasNegativeRealBox1.×10−20,1.×10−20

true

(57)

HasNegativeRealBox0

false

(58)

HasNegativeRealBox0,1.×10−40

true

(59)

HasNegativeRealBox1.×10−39,1.×10−40

false

(60)

HasNonNegativeRealBox0

true

(61)

HasNonNegativeRealBox1.×10−20,1.×10−20

true

(62)

HasNonNegativeRealBox1.×10−20,1.×10−21

false

(63)

HasNonPositiveRealBox0

true

(64)

IsInfinityRealBox

true

(65)

IsInfinityRealBox0,

false

(66)

IsInfinityRealBox

false

(67)

IsNegInfinityRealBox

true

(68)

IsUndefinedRealBoxFloatundefined

true

(69)

Compatibility

• 

The RealBox[UnaryPredicates], RealBox:-IsZero, RealBox:-IsNonzero, RealBox:-IsOne, RealBox:-IsFinite, RealBox:-IsExact, RealBox:-IsInteger, RealBox:-IsPositive, RealBox:-IsNegative, RealBox:-IsNonPositive, RealBox:-IsNonNegative, RealBox:-HasInteger, RealBox:-HasZero, RealBox:-HasPositive, RealBox:-HasNegative, RealBox:-HasNonNegative, RealBox:-HasNonPositive, RealBox:-IsInfinity, RealBox:-IsNegInfinity and RealBox:-IsUndefined commands were introduced in Maple 2022.

• 

For more information on Maple 2022 changes, see Updates in Maple 2022.

See Also

ComplexBox

RealBox

RealBox[BinaryPredicates]