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

Online Help

All Products    Maple    MapleSim


RealBox

Box objects on the real line

 

Calling Sequence

Parameters

Description

Precision

Creating Real Boxes

Special Constants

Predicates

Elementary Functions

Circular and Hyperbolic Functions

Special Functions

Compatibility

Calling Sequence

RealBox( c, r )

RealBox( b )

Center( b )

Center( b, opt )

Radius( b )

Radius( b, opt )

Parameters

c

-

numeric; the center of the box

r

-

(optional) nonnegative number; the radius of the box

b

-

RealBox object

opt

-

(optional) equation; either form = float or form = rational

precopt

-

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

Description

• 

A RealBox object is defined by two numeric quantities, a center c and a non-negative radius r.

• 

You can access the center of a RealBox b by using the Center( b ) method, and the radius is available by using the Radius( b ) method.

• 

The method Centre is provided as an alias.

• 

Internally, RealBox objects represent the (finite) centre and radius as binary fractions (that is, with powers of 2 as their denominators). You can access the exact centre and radius by supplying the option form = rational.

• 

If the radius is finite, then a RealBox represents a closed and bounded interval of the real line, namely cr,c+r. In particular, a RealBox with radius equal to 0 represents the single point c.

• 

If the radius is infinite, the corresponding RealBox represents the entire real line.

• 

RealBox objects can be combined using arithmetic operations, and have methods that allow you to apply many mathematical functions to them. These operations are effected using a version of interval arithmetic, adapted to boxes.

• 

Arithmetic and mathematical functions applied to a real box also produce a real box as output. The result of an operation is guaranteed to contain the true value of the result of applying the function or arithmetic operation to any value of the input box or boxes. Thus, if f is an implemented function, then fcr,c+r is a box of the form xs,x+s, where x and s are such that, for any value t in the box cr,c+r, the value ft lies in the box xs,x+s.

Precision

• 

Operations such as arithmetic and the implemented elementary and special functions are controlled by a quantity called the precision. This is a positive integer value that you can set by assigning a value to the environment variable _EnvBoxPrecision.

• 

Many methods for RealBox objects also accept an option of the form precision = n, for a positive integer n, which allows you to exert local control over precision.

• 

For more details, see BoxPrecision.

Creating Real Boxes

• 

The simplest way to create a RealBox object is to pass the RealBox constructor a real constant.

• 

To create a real box with a numeric value c as its center, and with radius equal to 0, just pass the value c to the RealBox object.

b := RealBox( 0.5 );

bRealBox: 0.5±0

(1)

Center( b );

0.500000000000000

(2)

Radius( b );

0.

(3)
• 

This uses the default value of 0 as the radius, which means that the box object represents the value of its center exactly.

• 

To specify a nonzero radius, the radius argument r can be passed as a second, optional argument.

b := RealBox( 0.5, 1e-5 );

bRealBox: 0.5±1e-05

(4)

Center( b );

0.500000000000000

(5)

Radius( b );

0.0000100000000031741

(6)
• 

However, the actual radius of a RealBox object depends upon not only the value passed, but also the precision used for construction, as not all values can be exactly represented in floating point.

• 

The rational number 32 can be represented exactly as a float.

b1 := RealBox( 3/2 );

b1RealBox: 1.5±0

(7)
• 

Thus, the radius of the resulting box is, in fact, the default value of 0.

Radius( b1 );

0.

(8)
• 

On the other hand, the number 23 is not exactly representable, so the radius of a RealBox representation is nonzero.

b2 := RealBox( 2/3 );

b2RealBox: 0.666667±5.82077ⅇ-11

(9)
• 

The resulting radius is sufficient to ensure that the exact value 23 is contained within the resulting box.

Radius( b2 );

5.82076609134674×10−11

(10)

evalb( Center( b2 ) - Radius( b2 ) <= 2/3 );

true

(11)

evalb( 2/3 <= Center( b2 ) + Radius( b2 )  );

true

(12)
• 

Increasing the precision results in a box with smaller radius.

b3 := RealBox( 2/3, precision = 100 );

b3RealBox: 0.666667±7.88861&ExponentialE;-31

(13)
• 

We can find the exact rational numbers representing the interval using the option form = rational.

cb3 := Center(b3, form = rational);

cb38451004001521529343311354702511267650600228229401496703205376

(14)

evalf(abs(cb3 - 2/3));

2.629536351×10−31

(15)

rb3 := Radius(b3, form = rational);

rb311267650600228229401496703205376

(16)

ifactor(rb3);

12100

(17)

evalf(rb3);

7.888609052×10−31

(18)

Special Constants

• 

There are several special values and constants implemented that can be passed as an argument to the RealBox object constructor. For some of these, such as infinities, it is not meaningful to specify a nonzero radius. For special constants, the implemented algorithms by default return a RealBox object with a radius determined by the precision.

RealBox( Pi );

RealBox: 3.14159±1.16415&ExponentialE;-10

(19)

RealBox( Pi, 0.001 );

RealBox: 3.14159±0.001

(20)

RealBox( Pi, 'precision' = 1000 );

RealBox: 3.14159±1.86653&ExponentialE;-301

(21)

RealBox( sqrt( Pi ) );

RealBox: 1.77245±1.16415&ExponentialE;-10

(22)

RealBox( ln( sqrt( 2*Pi ) ) );

RealBox: 0.918939±3.40258&ExponentialE;-10

(23)

RealBox( log( 2 ), 'precision' = 100 );

RealBox: 0.693147±3.94430&ExponentialE;-31

(24)

RealBox( log( 10 ) );

RealBox: 2.30259±2.32831&ExponentialE;-10

(25)

RealBox( exp( 1 ) );

RealBox: 2.71828±2.32831&ExponentialE;-10

(26)

RealBox( Catalan );

RealBox: 0.915966±5.82077&ExponentialE;-11

(27)

RealBox( gamma );

RealBox: 0.577216±5.82077&ExponentialE;-11

(28)

RealBox( Zeta( 3 ) );

RealBox: 1.20206±1.16415&ExponentialE;-10

(29)

RealBox( infinity );

RealBox: Inf±0

(30)

RealBox( -infinity );

RealBox: -Inf±0

(31)

RealBox( undefined );

RealBox: nan±0

(32)
• 

Note the following raises an exception.

RealBox( infinity, 0.0001 );

Error, (in RealBox:-ModuleCopy) a non-zero radius is not permitted for special values

Predicates

• 

A number of predicates are implemented for RealBox objects. Typically, a predicate returns true if the result is certainly true for all real numbers in the box. If a predicate returns the value false, then the result may or may not be true for all values lying within the box. Thus, to determine whether a predicate is certainly false, you must also test whether the negated predicate is true.

Predicates

`<=`

compare two RealBox objects for inequality

`<`

compare two RealBox objects for strict inequality

Contains

test whether a RealBox object is contained in another

Eq

test whether two RealBox objects are mathematically equal

Equal

test whether two RealBox objects are equal as objects

HasInteger

test whether a RealBox contains an integer

HasNegative

test whether a RealBox contains a negative value

HasNonNegative

test whether a RealBox contains a non-negative value

HasNonPositive

test whether a RealBox contains a non-positive value

HasPositive

test whether a RealBox contains a positive value

HasZero

test whether a RealBox contains zero

IsExact

test whether a RealBox is exact

IsFinite

test whether a RealBox is finite

IsInfinity

test whether a RealBox represents infinity

IsInteger

test whether a RealBox is an integer

IsNegative

test whether a RealBox is negative

IsNegInfinity

test whether a RealBox represents negative infinity

IsNonNegative

test whether a RealBox is non-negative

IsNonPositive

test whether a RealBox is non-positive

IsNonzero

test whether a RealBox is nonzero

IsOne

test whether a RealBox is one

IsPositive

test whether a RealBox is positive

IsUndefined

test whether a RealBox represents an undefined value

IsZero

test whether a RealBox is zero

LessEqual

compare two RealBox objects for inequality

LessThan

compare two RealBox objects for strict inequality

NotEq

test whether two RealBox objects are not equal

Overlaps

test whether two RealBox objects have a nonempty nntersection

Elementary Functions

• 

Many of the elementary functions are implemented as RealBox methods. A list of the available functions appears below.

Elementary

abs

calculate the absolute value of a RealBox object

ceil

calculate the ceiling of a RealBox object

exp

calculate the exponential of a RealBox object

expinvexp

calculate the exponential and reciprocal exponential of a RealBox object

expm1

calculate the exponential minus one of a RealBox object

floor

calculate the floor of a RealBox object

hypot

calculate the hypotenuse of a pair of real boxes

log

calculate the logarithm of a RealBox object

log1p

calculate the logarithm of one plus a RealBox object

rsqrt

calculate the reciprocal square root of a RealBox object

signum

calculate the sign of a RealBox object

sqrt

calculate the square root of a RealBox object

sqrtpos

calculate the positive square root of a RealBox object

Circular and Hyperbolic Functions

• 

The following circular and hyperbolic functions are available as methods for RealBox objects.

Circular

arccos

compute arccos of a RealBox

arccot

compute arccot of a RealBox

arccsc

compute arccsc of a RealBox

arcsec

compute arcsec of a RealBox

arcsin

compute arcsin of a RealBox

arctan

compute arctan of a RealBox

cos

compute cos of a RealBox

cospi

compute cospi of a RealBox

cot

compute cot of a RealBox

cotpi

compute cotpi of a RealBox

csc

compute csc of a RealBox

sec

compute sec of a RealBox

sin

compute sin of a RealBox

sinc

compute sinc of a RealBox

sincpi

compute sincpi of a RealBox

sinpi

compute sinpi of a RealBox

tan

compute tan of a RealBox

tanpi

compute tanpi of a RealBox

Hyperbolic

arccosh

compute the inverse hyperbolic cosine of a RealBox object

arccoth

compute the inverse hyperbolic cotangent of a RealBox object

arccsch

compute the inverse hyperbolic cosecant of a RealBox object

arcsech

compute the inverse hyperbolic secant of a RealBox object

arcsinh

compute the inverse hyperbolic sine of a RealBox object

arctanh

compute the inverse hyperbolic tangent of a RealBox object

cosh

compute the hyperbolic cosine of a RealBox object

coth

compute the hyperbolic cotangent of a RealBox object

csch

compute the hyperbolic cosecant of a RealBox object

sech

compute the hyperbolic secant of a RealBox object

sinh

compute the hyperbolic sine of a RealBox object

sinhcosh

compute the hyperbolic sine and hyperbolic cosine of a RealBox object

tanh

compute the hyperbolic tangent of a RealBox object

Special Functions

• 

Many special and hypergeometric functions have been provided as RealBox object methods, as listed below.

Special

AiryAi

compute the Airy Ai wave function of a RalBox

AiryBi

compute the Airy Bi wave function of a RealBox

BesselI

compute the Bessel I function of a RealBox

BesselJ

compute the Bessel J function of a RealBox

BesselK

compute the Bessel K function of a RealBox

BesselY

compute the Bessel Y function of a RealBox

ChebyshevT

Chebyshev T function of a RealBox

ChebyshevU

Chebyshev U function of a RealBox

Chi

compute the hyperbolic cosine integral of a RealBox

Ci

compute the cosine integral of a RealBox

CoulombF

Coulomb's F function of a RealBox

CoulombG

Coulomb's G function of a RealBox

dilog

compute the dilogarithm function of a RealBox

Ei

compute the exponential intergral of a RealBox

erf

compute the error function of a RealBox

erfc

compute the complementary error function of a RealBox

erfi

compute the imaginary error function of a RealBox

GAMMA

compute the GAMMA function of a RealBox

GegenbauerC

Gegenbauer C function of a RealBox

HermiteH

Hermite H function of a RealBox

hypergeom

general hypergeometric function of a RelaBox

JacobiP

Jacobi U function of a RealBox

KummerM

Kummer M function of a RealBox

KummerU

Kummer U function of a RealBox

LaguerreL

Laguerre L function of a RealBox

LambertW

compute the Lambert W function of a RealBox

LegendreP

Legendre P function of a RealBox

lnGAMMA

compute the log-GAMMA function of a RealBox

Psi

compute the Digamma function of a RealBox

rGAMMA

compute the reciprocal GAMMA function of a RealBox

Shi

compute the hyperbolic sine integral of a RealBox

Si

compute the sine integral of a RealBox

Zeta

compute the Riemann Zeta function of a RealBox

Compatibility

• 

The RealBox command was introduced in Maple 2022.

• 

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

See Also

BoxPrecision

ComplexBox

RealBox[Circular]

RealBox[Elementary]

RealBox[Hyperbolic]

RealBox[Hypergeom]

RealBox[Predicates]

RealBox[Special]